Skip to content

Commit

Permalink
fix: fix apollo headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Klesse committed Jun 13, 2024
1 parent 8d8ed4c commit 086761f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/runtime/plugins/apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default defineNuxtPlugin({
const authLink = setContext((_, { headers }) => {
const { accessTokenState, refreshTokenState } = useAuthState();
let token: string;
let cookies: string = headers?.cookies ?? defaultHeaders?.cookies ?? '';
// let cookies: string = headers?.cookies ?? defaultHeaders?.cookies ?? '';

console.log(defaultHeaders, headers);

Expand All @@ -88,19 +88,18 @@ export default defineNuxtPlugin({
}
}

if (process.client) {
console.log('process.client', cookies);
cookies = document.cookie;
}
// if (process.client) {
// console.log('process.client', cookies);
// cookies = document.cookie;
// }

console.log('cookies', cookies);
// console.log('cookies', cookies);

return {
headers: {
...headers,
...defaultHeaders,
Authorization: token ? `Bearer ${token}` : '', // Token in header
origin: headers.origin ?? defaultHeaders?.origin ?? defaultHeaders?.referer,
},
};
});
Expand Down

0 comments on commit 086761f

Please sign in to comment.