fix: make workspace navigation atomic and return home on account switch

This commit is contained in:
SantaSpeen committed 2026-10-25 21:19:10 +03:00
1 parent c02bf755f2
commit 55f2474660
21 files changed
+709 -61

No files matched your search

+13 -6
View File
@@ -1,7 +1,14 @@
<template>
<div>
<h1 class="sr-only">{{ name }}</h1>
<SessionGate v-if="blocked" />
<div
v-if="auth.accountChanged && route.meta.requiresAuth && !blocked"
class="message"
role="status"
>
{{ $t("files.loading") }}
</div>
<SessionGate v-else-if="blocked" />
<router-view v-else :key="auth.epoch"></router-view>
</div>
</template>
@@ -23,16 +30,16 @@ const auth = useAuthStore(),
route = useRoute(),
router = useRouter();
watch(
() => auth.user?.id,
(id, old) => {
if (id && old && id !== old && route.meta.requiresAuth)
void router.replace("/files/");
() => auth.accountChanged,
(changed) => {
if (changed && route.meta.requiresAuth)
void router.replace({ path: "/files/", force: true });
}
);
watch(
() => auth.user?.perm.admin,
(admin) => {
if (admin === false && route.meta.requiresAdmin)
if (admin === false && !auth.accountChanged && route.meta.requiresAdmin)
void router.replace("/403");
}
);