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:
2026-07-02 16:37:06 -03:00
parent 57f58c92be
commit 6ffffc6ea8
17 changed files with 1206 additions and 31 deletions

View File

@@ -2,6 +2,7 @@ import { Routes } from '@angular/router';
import { AuthLayoutComponent } from '../../core/layout/auth-layout/auth-layout.component';
import { StoreLayoutComponent } from '../../core/layout/store-layout/store-layout.component';
import { guestOnlyGuard } from '../../core/services/auth/auth.guards';
import { LoginPageComponent } from './pages/login-page/login-page.component';
import { RegisterPageComponent } from './pages/register-page/register-page.component';
import { StoreHomePageComponent } from './pages/store-home-page/store-home-page.component';
@@ -17,6 +18,7 @@ export const routes: Routes = [
},
{
path: 'login',
canActivate: [guestOnlyGuard],
component: AuthLayoutComponent,
children: [
{
@@ -27,6 +29,7 @@ export const routes: Routes = [
},
{
path: 'register',
canActivate: [guestOnlyGuard],
component: AuthLayoutComponent,
children: [
{