Tax is added directly to product for sale
Auth guard and auth service simplified and fixed so that user is updated upon login Home component changed to use square buttons Fixed showing the totals in the bill ng linted the project
This commit is contained in:
@ -20,7 +20,8 @@ export class AuthGuard implements CanActivate {
|
||||
this.toaster.show('Danger', 'User is not authenticated');
|
||||
return false;
|
||||
}
|
||||
const hasPermission = permission === undefined || user.perms.indexOf(permission) !== -1;
|
||||
|
||||
const hasPermission = this.auth.hasPermission(permission);
|
||||
if (!hasPermission) {
|
||||
this.toaster.show('Danger', 'You do not have the permission to access this area.');
|
||||
}
|
||||
@ -28,14 +29,11 @@ export class AuthGuard implements CanActivate {
|
||||
}
|
||||
|
||||
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||
if (this.auth.user === undefined) {
|
||||
return this.auth.userObservable
|
||||
.pipe(
|
||||
map<User, boolean>((value: User) => this.checkUser(
|
||||
next.data['permission'], value, state
|
||||
))
|
||||
);
|
||||
}
|
||||
return this.checkUser(next.data['permission'], this.auth.user, state);
|
||||
return this.auth.userObservable
|
||||
.pipe(
|
||||
map<User, boolean>((value: User) => this.checkUser(
|
||||
next.data['permission'], value, state
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user