responseType_ = 'text'; | responseType_ = 'text'; | ||||
} | } | ||||
return this.httpClient.get<Array<Rule>>(`${this.configuration.basePath}/rules/admin`, | |||||
return this.httpClient.get<Array<Rule>>(`${this.configuration.basePath}/rules/admin/all`, | |||||
{ | { | ||||
responseType: <any>responseType_, | responseType: <any>responseType_, | ||||
withCredentials: this.configuration.withCredentials, | withCredentials: this.configuration.withCredentials, |
<span [routerLink]="['/admin/create']"> | <span [routerLink]="['/admin/create']"> | ||||
<mat-icon>add</mat-icon> | <mat-icon>add</mat-icon> | ||||
</span> | </span> | ||||
<span *ngIf="isLogedIn()" (click)="logout()"> | |||||
<mat-icon>logout</mat-icon> | |||||
</span> | |||||
</mat-toolbar> | </mat-toolbar> |
import { Component, OnInit } from '@angular/core'; | import { Component, OnInit } from '@angular/core'; | ||||
import { Router } from '@angular/router'; | |||||
import { AuthService } from '../auth/service/auth.service'; | |||||
@Component({ | @Component({ | ||||
selector: 'app-footer', | selector: 'app-footer', | ||||
}) | }) | ||||
export class FooterComponent implements OnInit { | export class FooterComponent implements OnInit { | ||||
constructor() { } | |||||
constructor(protected authService: AuthService, protected router: Router) { } | |||||
ngOnInit(): void { | ngOnInit(): void { | ||||
} | } | ||||
isLogedIn (): boolean { | |||||
return !!this.authService.user; | |||||
} | |||||
logout () { | |||||
this.authService.logout(); | |||||
this.router.navigate(['login']); | |||||
} | |||||
} | } |