🐛 Trying to fix auth middleware

This commit is contained in:
2025-10-04 15:19:27 +08:00
parent 4327083e03
commit 453319bac1

View File

@@ -3,10 +3,12 @@ import { keysToCamel, keysToSnake } from "~/utils/transformKeys"
export const useSolarNetwork = (withoutProxy = false) => {
const apiBase = useSolarNetworkUrl(withoutProxy)
const headers = process.server ? useRequestHeaders(["cookie"]) : {}
return $fetch.create({
baseURL: apiBase,
credentials: "include",
headers,
// Add Authorization header with Bearer token
onRequest: ({ request, options }) => {
const side = process.server ? "SERVER" : "CLIENT"