fix reactivity

This commit is contained in:
Emily
2024-08-06 03:00:24 +02:00
parent ba1d6c4bd0
commit 46774bd114
7 changed files with 167 additions and 93 deletions

View File

@@ -9,6 +9,11 @@ export function signHeaders(headers?: Record<string, string>) {
return { headers: { ...(headers || {}), 'Authorization': 'Bearer ' + token.value } }
}
export const authorizationHeaderComputed = computed(() => {
const { token } = useAccessToken()
return token.value ? 'Bearer ' + token.value : '';
});
export function useAccessToken() {
const tokenCookie = useCookie(ACCESS_TOKEN_COOKIE_KEY, { expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30) })