feat: login and register, style is not ready

This commit is contained in:
Lala, Shahd
2026-05-03 20:44:01 +00:00
parent 3b757d7ff7
commit aa70083aed
27 changed files with 1083 additions and 308 deletions
+22
View File
@@ -0,0 +1,22 @@
import { HttpInterceptorFn } from '@angular/common/http';
export const authInterceptor: HttpInterceptorFn = (req, next) => {
const token = localStorage.getItem('token');
// Add token to protected endpoints only (not registration or login)
const isProtectedEndpoint =
req.url.includes('/api/account/me') ||
req.url.includes('/api/account/bots') ||
req.url.includes('/api/account/official-bots') ||
req.url.includes('/api/challenge');
if (token && isProtectedEndpoint) {
req = req.clone({
setHeaders: {
Authorization: `Bearer ${token}`
}
});
}
return next(req);
};