mirror of
https://github.com/Drop-OSS/drop
synced 2026-08-27 14:23:05 -04:00
parent
cbecd1161d
commit
38c11567ef
5 changed files with 97 additions and 38 deletions
|
|
@ -2,14 +2,13 @@ const whitelistedPrefixes = ["/auth", "/api", "/setup"];
|
|||
const requireAdmin = ["/admin"];
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
if (import.meta.server) return;
|
||||
const error = useError();
|
||||
if (error.value !== undefined) return;
|
||||
if (whitelistedPrefixes.findIndex((e) => to.fullPath.startsWith(e)) != -1)
|
||||
return;
|
||||
|
||||
const user = useUser();
|
||||
if (user === undefined) {
|
||||
if (user.value === undefined) {
|
||||
await updateUser();
|
||||
}
|
||||
if (!user.value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue