Implement a complete authentication system including a new login page, updated authentication service, and conditional routing. - Add `LoginPage` component with animated UI and form validation - Update `AuthService` to handle user sessions, CSRF tokens, and enhanced user data structures - Implement conditional rendering in `App` component based on authentication state - Add `postRaw` and `getRaw` methods to `HttpService` for direct API interaction - Update routing to include login path and prepare for auth guards - Add rate limiting error handling (429) in `HttpService`
27 lines
792 B
TypeScript
27 lines
792 B
TypeScript
import { Component, inject, signal } from '@angular/core';
|
|
import { CommonModule } from '@angular/common';
|
|
import { LayoutComponent } from './layout/layout.component';
|
|
import { LoginPage } from './pages/login/login.page';
|
|
import { AuthService } from './services/auth/auth.service';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
standalone: true,
|
|
imports: [CommonModule, LayoutComponent, LoginPage],
|
|
templateUrl: './app.html',
|
|
styleUrl: './app.css',
|
|
})
|
|
export class App {
|
|
private readonly authService = inject(AuthService);
|
|
|
|
readonly isAuthenticated = signal<boolean>(this.authService.isAuthenticated());
|
|
|
|
constructor() {
|
|
this.authService.currentUserSubject.subscribe({
|
|
next: () => {
|
|
this.isAuthenticated.set(this.authService.isAuthenticated());
|
|
},
|
|
});
|
|
}
|
|
}
|