Fix useContent not using cookies therefore skipping the auth step

This commit is contained in:
2025-01-05 22:43:40 +01:00
parent 9515132659
commit 896af11fa7
15 changed files with 37 additions and 39 deletions

View File

@@ -2,9 +2,13 @@ import { hasPermissions } from "#shared/auth.util";
export default defineNuxtRouteMiddleware(async (to, from) => {
const { loggedIn, fetch, user } = useUserSession();
const { fetch: fetchContent } = useContent();
const meta = to.meta;
await fetch();
if(await fetch())
{
fetchContent(true);
}
if(!!meta.guestsGoesTo && !loggedIn.value)
{
@@ -34,8 +38,5 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
}
}
const { fetch: fetchContent } = useContent();
await fetchContent(false);
return;
});