diff --git a/middleware/auth.ts b/middleware/auth.ts index fc89050..5bed634 100644 --- a/middleware/auth.ts +++ b/middleware/auth.ts @@ -1,5 +1,5 @@ export default defineNuxtRouteMiddleware(async (to) => { - const { loggedIn, login, user } = useOidcAuth(); + const { loggedIn, login } = useOidcAuth(); if (!loggedIn.value && to.path !== "/") { console.warn("Not logged in"); return login(); diff --git a/plugins/api.ts b/plugins/api.ts index 9ef78bd..b12fd7e 100644 --- a/plugins/api.ts +++ b/plugins/api.ts @@ -3,7 +3,7 @@ import { showHubAdapterConnectionErrorToast, } from "~/composables/connectionErrorToast"; -export default defineNuxtPlugin((nuxtApp) => { +export default defineNuxtPlugin(() => { const { user, login } = useOidcAuth(); const config = useRuntimeConfig(); const baseUrl = config.public.hubAdapterUrl as string; @@ -22,12 +22,13 @@ export default defineNuxtPlugin((nuxtApp) => { }, onResponseError({ request, response }) { // Handle the response errors - console.log(response); if (response.status === 401 || response.status === 403) { - console.warn("User not signed in, routing to login"); + console.warn("User not signed in, returning to login"); return login(); } + console.log(response); + if (response.status === 500) { if (typeof request === "string" && request.includes("kong")) { showKongConnectionErrorToast();