Skip to content

Commit 4550e9b

Browse files
committed
fix: made headers reactive
1 parent 7f579b1 commit 4550e9b

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/runtime/composables/gql-async-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export async function gqlAsyncQuery<T = any>(method: string, options: IGraphQLOp
125125
await callWithNuxt(_nuxtApp, checkTokenAndRenew);
126126

127127
const requestHeaders: Record<string, string> = {
128-
...headers,
128+
...headers.value,
129129
...(options.headers || {}),
130130
authorization: `Bearer ${accessTokenState.value}`,
131131
};

src/runtime/composables/gql-mutation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export async function gqlMutation<T = any>(method: string, options: IGraphQLOpti
135135
}
136136

137137
const requestHeaders: Record<string, string> = {
138-
...headers,
138+
...headers.value,
139139
...(options.headers || {}),
140140
authorization: `Bearer ${method === 'refreshToken' ? refreshTokenState.value : accessTokenState.value}`,
141141
};

src/runtime/composables/gql-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export async function gqlQuery<T = any>(method: string, options: IGraphQLOptions
124124
await callWithNuxt(_nuxtApp, checkTokenAndRenew);
125125

126126
const requestHeaders: Record<string, string> = {
127-
...headers,
127+
...headers.value,
128128
...(options.headers || {}),
129129
authorization: `Bearer ${accessTokenState.value}`,
130130
};

src/runtime/composables/use-auth-fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function useAuthFetch<
2525
async onRequest(data: any) {
2626
if (accessTokenState.value) {
2727
data.options.headers = {
28-
...headers,
28+
...headers.value,
2929
...data.options.headers,
3030
Authorization: `Bearer ${accessTokenState.value}`,
3131
};

src/runtime/plugins/ws.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default defineNuxtPlugin({
1919
const { accessTokenState } = useAuthState();
2020
return {
2121
Authorization: 'Bearer ' + accessTokenState.value,
22-
...headers,
22+
...headers.value,
2323
...wsHeaders,
2424
};
2525
},

0 commit comments

Comments
 (0)