From e6ba48dc2fd77436b76714b134bd78ce1b9a6e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Sun, 8 Dec 2024 23:22:40 -0500 Subject: [PATCH] refactor(client-side): update story check middleware if fetching a story returns an error, check that the error code is 403 (forbidden) as well before redirecting --- lib/client/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client/middleware.ts b/lib/client/middleware.ts index 23801e0..60e21aa 100644 --- a/lib/client/middleware.ts +++ b/lib/client/middleware.ts @@ -14,7 +14,7 @@ export const storyMiddleware = defineNuxtRouteMiddleware(async (to, from) => { console.log("to n from", to, from, data); const { data: story, error } = await useApiFetch(to.path); if (error.value) { - if (error.value.message.toLocaleLowerCase() == "unauthenticated") { + if (error.value.message.toLocaleLowerCase() == "unauthenticated" || error.value.statusCode == "403") { return navigateTo("/auth/login"); } return showError(error.value);