add logout button and update title in header #50
@ -1,4 +1,10 @@
|
||||
<main class="container mx-auto px-4 py-8 max-w-6xl">
|
||||
<h1 class="text-3xl font-bold text-gray-900 mb-8">{{ title }}</h1>
|
||||
<div class="flex justify-between items-center mb-8">
|
||||
<h1 class="text-3xl font-extrabold text-gray-900">{{ title }}</h1>
|
||||
<button mat-flat-button class="!bg-red-600 !text-white" (click)="logout()">
|
||||
<mat-icon>logout</mat-icon>
|
||||
<span class="ml-1">Logout</span>
|
||||
</button>
|
||||
</div>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
|
@ -1,14 +1,22 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { AuthService } from './services/auth.service';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [CommonModule, RouterOutlet],
|
||||
imports: [CommonModule, RouterOutlet, MatButtonModule, MatIconModule],
|
||||
templateUrl: './app.component.html',
|
||||
standalone: true,
|
||||
styleUrl: './app.component.css',
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'Employee Management System';
|
||||
|
||||
constructor(private authService: AuthService) {}
|
||||
|
||||
logout(): void {
|
||||
this.authService.logout();
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,8 @@ export class AuthService {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public logout(): void {
|
||||
this.keycloakService.logout();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Lf10StarterNew</title>
|
||||
<title>Employee Management System</title>
|
||||
<base href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
|
Reference in New Issue
Block a user