refactor: LivstView Cabinet and Drawer can CRUD

This commit is contained in:
somnetsak123 2023-11-28 09:22:44 +07:00 committed by Methapon2001
parent a28bc7de6b
commit 3553164a8a
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
6 changed files with 183 additions and 42 deletions

View file

@ -18,10 +18,11 @@ const router = createRouter({
KeyCloakService.CallLogin(() => {
const tokenAfterLogin = KeyCloakService.GetAccesToken()
const roles = KeyCloakService.GetUserRoles()
console.log(roles);
if (tokenAfterLogin && (roles.includes('user') || roles.includes('admin')) ) {
if (
tokenAfterLogin &&
(roles.includes('user') || roles.includes('admin'))
) {
next()
} else {
console.error('ไม่สามารถดึง Token หลังจากล็อกอินได้')
@ -47,10 +48,9 @@ const router = createRouter({
KeyCloakService.CallLogin(() => {
const tokenAfterLogin = KeyCloakService.GetAccesToken()
const roles = KeyCloakService.GetUserRoles()
console.log(roles);
console.log(roles)
if (tokenAfterLogin && roles.includes('admin') ) {
if (tokenAfterLogin && roles.includes('admin')) {
next()
} else {
console.error('ไม่สามารถดึง Token หลังจากล็อกอินได้')