[feat] - add authen and display transaction data
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AppService } from '../../app.service';
|
||||
import { MENU } from "../../@config/menus";
|
||||
import { MENU, NOT_ADMIN, ROLE_ADMIN } from "../../@config/menus";
|
||||
|
||||
@Component({
|
||||
selector: 'app-pages-layouts',
|
||||
@@ -35,6 +35,20 @@ export class PagesLayoutsComponent implements OnInit {
|
||||
}
|
||||
async initAuth() {
|
||||
this.auth = this.app.auth();
|
||||
console.log(this.auth.isAdmin)
|
||||
this.menus = this.menus.map(r => {
|
||||
if(this.auth.isAdmin){
|
||||
if(r.roles.includes(ROLE_ADMIN)) return {
|
||||
...r,
|
||||
children: r.children.length ? r.children.filter(c => r.roles.includes(ROLE_ADMIN)) : []
|
||||
}
|
||||
} else {
|
||||
if(r.roles.includes(NOT_ADMIN)) return {
|
||||
...r,
|
||||
children: r.children.length ? r.children.filter(c => r.roles.includes(NOT_ADMIN)) : []
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (!this.permissionCheck) {
|
||||
// const users = await lastValueFrom(this.app.get(`${API.users}/getById/${this.auth.id}`));
|
||||
|
||||
Reference in New Issue
Block a user