feat(auth): implement authentication service, guards, and interceptors
- Add AuthService for handling login, registration, and session management. - Create auth guards to protect routes based on authentication status. - Implement auth interceptor to attach JWT token to HTTP requests and handle 401 errors. - Add unit tests for AuthService, guards, and interceptor. - Create login and registration components with form validation and error handling. - Update routing to include guards for login and registration pages.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { provideHttpClient, withFetch } from '@angular/common/http';
|
||||
import { provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
|
||||
import { ApplicationConfig, provideAppInitializer, provideBrowserGlobalErrorListeners } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { provideClientHydration } from '@angular/platform-browser';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
import { authBootstrap } from './core/services/auth/auth-bootstrap';
|
||||
import { authInterceptor } from './core/services/auth/auth.interceptor';
|
||||
import { tenantBootstrap } from './core/services/tenant-bootstrap';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
@@ -11,7 +13,8 @@ export const appConfig: ApplicationConfig = {
|
||||
provideBrowserGlobalErrorListeners(),
|
||||
provideRouter(routes),
|
||||
provideClientHydration(),
|
||||
provideHttpClient(withFetch()),
|
||||
provideHttpClient(withFetch(), withInterceptors([authInterceptor])),
|
||||
provideAppInitializer(authBootstrap),
|
||||
provideAppInitializer(tenantBootstrap)
|
||||
]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user