Skip to content

Commit fb52125

Browse files
committed
fix: fixed headers on authFetch
1 parent 0b582a5 commit fb52125

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ export function useAuthFetch<
2323
...opts,
2424
baseURL: config.public.host,
2525
async onRequest(data: any) {
26+
data.options.headers = {
27+
...headers.value,
28+
...data.options.headers,
29+
};
30+
2631
if (accessTokenState.value) {
27-
data.options.headers = {
28-
...headers.value,
29-
...data.options.headers,
30-
Authorization: `Bearer ${accessTokenState.value}`,
31-
};
32+
data.options.headers.Authorization = `Bearer ${accessTokenState.value}`;
3233
}
3334
},
3435
onResponseError: async () => {

0 commit comments

Comments
 (0)