Added: Alembic for migrations
Moving from Pyramid to FastAPI
This commit is contained in:
@ -4,11 +4,11 @@
|
||||
Point of Sale
|
||||
</a>
|
||||
<span class="fill-remaining-space"></span>
|
||||
<button mat-button [routerLink]="['/', 'login']" *ngIf="!(user | async)">
|
||||
<button mat-button [routerLink]="['/', 'login']" *ngIf="!(auth.currentUser | async)">
|
||||
<mat-icon>account_box</mat-icon>
|
||||
Login
|
||||
</button>
|
||||
<button mat-button [routerLink]="['/', 'logout']" *ngIf="user | async as name">
|
||||
<button mat-button [routerLink]="['/', 'logout']" *ngIf="(auth.currentUser | async)?.name as name">
|
||||
<mat-icon>account_box</mat-icon>
|
||||
Logout {{name}}
|
||||
</button>
|
||||
|
||||
@ -1,24 +1,20 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Observable } from "rxjs";
|
||||
import { map, share } from "rxjs/operators";
|
||||
import { AuthService } from "../auth/auth.service";
|
||||
import { Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nav-bar',
|
||||
templateUrl: './nav-bar.component.html',
|
||||
styleUrls: ['./nav-bar.component.css']
|
||||
})
|
||||
export class NavBarComponent implements OnInit {
|
||||
public user: Observable<string>;
|
||||
export class NavBarComponent {
|
||||
|
||||
constructor(public auth: AuthService) {
|
||||
constructor(private router: Router, public auth: AuthService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.user = this.auth.userObservable.pipe(
|
||||
map (x => x.isAuthenticated ? x.name : null),
|
||||
share()
|
||||
);
|
||||
}
|
||||
logout() {
|
||||
this.auth.logout();
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user