fix(coming-soon): let logged-in admins bypass the gate
All checks were successful
Test / vitest (push) Successful in 11m15s
Test / playwright (push) Successful in 16m10s
Test / Notify on failure (push) Has been skipped

Admins can now load the public site and their dashboard while coming-soon
mode is on, instead of being redirected to /coming-soon for everything
outside /admin/*.
This commit is contained in:
Jennie Robinson Faber 2026-05-01 14:13:43 +01:00
parent 84aea08a5f
commit 0927b66b4f

View file

@ -21,6 +21,15 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
return;
}
// Logged-in admins bypass coming-soon (and see the public site + their dashboard)
try {
const headers = import.meta.server ? useRequestHeaders(["cookie"]) : undefined;
const member = await $fetch("/api/auth/member", { headers });
if (member?.role === "admin") return;
} catch {
// Not authenticated — fall through to redirect
}
// Redirect all other routes to coming-soon
return navigateTo("/coming-soon");
});