Skip to content

Commit

Permalink
Merge pull request #15 from Cecropia/TG-15-LogOut
Browse files Browse the repository at this point in the history
TG-15 Logout
  • Loading branch information
cvillarongace authored Nov 8, 2024
2 parents 8603a94 + 59bf3e0 commit 2a5b236
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './guard/auth.guard';
import { AppComponent } from './app.component';

import { HomeComponent } from './home/home.component';
import { CounterComponent } from './counter/counter.component';
import { FetchDataComponent } from './fetch-data/fetch-data.component';
import { HomeComponent } from './home/home.component';
import { TodoComponent } from './todo/todo.component';

const routes: Routes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<a class="nav-link text-dark" href="/api" target="_blank">API</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" href="/Identity/Account/Manage">Account</a>
<a class="nav-link text-dark" (click)="logOut()">Log Out</a>
</li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Component } from '@angular/core';
import { KeycloakService } from 'keycloak-angular';

@Component({
selector: 'app-nav-menu',
templateUrl: './nav-menu.component.html',
styleUrls: ['./nav-menu.component.scss']
})
export class NavMenuComponent {

constructor(protected readonly keycloak: KeycloakService) {
this.keycloak = keycloak;
}

isExpanded = false;

collapse() {
Expand All @@ -15,4 +21,8 @@ export class NavMenuComponent {
toggle() {
this.isExpanded = !this.isExpanded;
}

async logOut() {
await this.keycloak.logout(window.location.origin);
}
}

0 comments on commit 2a5b236

Please sign in to comment.