somewhere

This commit is contained in:
Swift
2023-08-17 13:05:51 +03:30
parent 30c7eb0e7b
commit 53843207cc
429 changed files with 117489 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
export default async function ({ $auth, redirect, route }) {
try {
if (route.name === 'admin') {
return true
} else {
let hasPermission = false
for await (const permission of $auth.user.permissions) {
if ((await route.name.includes(permission)) && permission !== '') hasPermission = true
}
if (hasPermission) return true
else redirect('/admin')
}
} catch (e) {
redirect('/admin')
}
}