final delete
This commit is contained in:
parent
ab02108a20
commit
901a044b7d
@ -91,13 +91,7 @@ class HttpClient {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (accessToken) {
|
||||
headers.set("Authorization", `Bearer ${accessToken}`);
|
||||
|
||||
console.log("🔑 Token being sent:", accessToken.substring(0, 20) + "...");
|
||||
} else {
|
||||
console.log("❌ No access token found!");
|
||||
}
|
||||
if (accessToken) headers.set("Authorization", `Bearer ${accessToken}`);
|
||||
headers.set("Content-Type", "application/json");
|
||||
|
||||
const res = await fetch(fullUrl, {
|
||||
|
||||
@ -8,25 +8,12 @@ export async function getServerAccessToken() {
|
||||
export function getClientAccessToken(): string | undefined {
|
||||
if (typeof window === "undefined") return undefined;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🍪 Debug cookies:", document.cookie);
|
||||
|
||||
const cookies = document.cookie.split(";");
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🍪 All cookies:", cookies);
|
||||
|
||||
const accessTokenCookie = cookies.find(cookie =>
|
||||
cookie.trim().startsWith("accessToken=")
|
||||
);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🍪 Found accessToken cookie:", accessTokenCookie);
|
||||
|
||||
if (!accessTokenCookie) return undefined;
|
||||
|
||||
// Use substring instead of split to handle tokens with = signs
|
||||
const token = accessTokenCookie.trim().substring("accessToken=".length);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🍪 Extracted token:", token.substring(0, 20) + "...");
|
||||
return token;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user