mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-10-09 08:47:24 -05:00
14 lines
327 B
TypeScript
14 lines
327 B
TypeScript
function notAllowed() {
|
|
return navigateTo("/");
|
|
}
|
|
|
|
export default defineNuxtRouteMiddleware(async (to) => {
|
|
const meStore = useMeStore();
|
|
if (!meStore.loaded) throw new Error("Mestore must be loaded before reaching this middleware");
|
|
|
|
// NeedsAuth
|
|
if (to.meta.needsAuth) {
|
|
if (!meStore.user) return notAllowed();
|
|
}
|
|
});
|