feat: add support for refresh tokens in internal stores

This commit is contained in:
mrjvs
2026-08-16 22:17:49 +02:00
parent b3b44751ea
commit 47d703f6fd
7 changed files with 53 additions and 15 deletions

View File

@@ -1,8 +1,8 @@
export const apiFetch = $fetch.create({
onRequest({ options }) {
const token = useAuthStore().getToken();
if (token) {
options.headers.set('Authorization', 'Bearer ' + token);
const tokens = useAuthStore().getTokens();
if (tokens) {
options.headers.set('Authorization', 'Bearer ' + tokens.accessToken);
}
},
async onResponseError({ response }) {