Compare commits
5 Commits
d3ce34ee31
...
d166ae5a8b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d166ae5a8b | ||
|
|
145d139e3a | ||
|
|
93417d1b37 | ||
|
|
ca3ea36a83 | ||
|
|
c59d9bbf57 |
@@ -1,7 +1,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-expand-lg bg-body-tertiary fs-5">
|
<nav class="navbar navbar-expand-lg bg-body-tertiary fs-5">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand fs-2 fw-bold" [routerLink]="['/']">SignFlow</a>
|
<a class="navbar-brand fs-2 fw-bold" [routerLink]="['/']">signFlow</a>
|
||||||
<!-- Navbars -->
|
<!-- Navbars -->
|
||||||
<div *ngIf="isLogedIn()" class="navbar-collapse collapse d-sm-inline-flex justify-content-center"
|
<div *ngIf="isLogedIn()" class="navbar-collapse collapse d-sm-inline-flex justify-content-center"
|
||||||
[ngClass]="{ show: isExpanded }">
|
[ngClass]="{ show: isExpanded }">
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export class NavbarComponent {
|
|||||||
async logInOut(): Promise<void> {
|
async logInOut(): Promise<void> {
|
||||||
if (this.isLogedIn())
|
if (this.isLogedIn())
|
||||||
return this.authService.logoutAsync().then(() => {
|
return this.authService.logoutAsync().then(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/login']);
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
this.router.navigate(['/login']);
|
this.router.navigate(['/login']);
|
||||||
|
|||||||
@@ -15,11 +15,21 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
login(credentials: { username: string; password: string }): Observable<any> {
|
login(credentials: { username: string; password: string }): Observable<any> {
|
||||||
return this.http.post(`${this.url}/login`, credentials);
|
return this.http.post(`${this.url}/login`, credentials).pipe(
|
||||||
|
tap({
|
||||||
|
next: res => this.#IsAuthenticated = true,
|
||||||
|
error: () => this.#IsAuthenticated = false
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
logout(): Observable<any> {
|
logout(): Observable<any> {
|
||||||
return this.http.post(`${this.url}/logout`, {});
|
return this.http.post(`${this.url}/logout`, {}).pipe(
|
||||||
|
tap({
|
||||||
|
next: res => this.#IsAuthenticated = false,
|
||||||
|
error: () => this.#IsAuthenticated = true
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async logoutAsync(): Promise<void> {
|
async logoutAsync(): Promise<void> {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 264 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 264 KiB |
Reference in New Issue
Block a user