diff --git a/app/composables/useSolarNetwork.ts b/app/composables/useSolarNetwork.ts index b30f85f..76a7c6c 100644 --- a/app/composables/useSolarNetwork.ts +++ b/app/composables/useSolarNetwork.ts @@ -8,12 +8,15 @@ export const useSolarNetwork = (withoutProxy = false) => { baseURL: apiBase, credentials: "include", // Add Authorization header with Bearer token - onRequest: ({ options }) => { + onRequest: ({ request, options }) => { + const side = process.server ? 'SERVER' : 'CLIENT' + console.log(`[useSolarNetwork] onRequest for ${request} on ${side}`) // Get token from user store const userStore = useUserStore() const token = userStore.token if (token) { + console.log('[useSolarNetwork] Token found, adding Authorization header.') if (!options.headers) { options.headers = new Headers() } @@ -23,6 +26,8 @@ export const useSolarNetwork = (withoutProxy = false) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any ;(options.headers as any)["Authorization"] = `Bearer ${token}` } + } else { + console.log('[useSolarNetwork] No token found, skipping Authorization header.') } // Transform request data from camelCase to snake_case diff --git a/app/pages/auth/authorize.vue b/app/pages/auth/authorize.vue index 1f3d6c2..cae3cde 100644 --- a/app/pages/auth/authorize.vue +++ b/app/pages/auth/authorize.vue @@ -53,7 +53,7 @@

This will allow - {{ clientInfo.clientName || "the app" }} to: + {{ clientInfo.clientName || "the app" }} to