token cache location set to localstorage instead of memory
This commit is contained in:
@@ -71,11 +71,11 @@ async function parseResponse<T>(response: Response): Promise<T> {
|
|||||||
|
|
||||||
async function buildAuthHeaders() {
|
async function buildAuthHeaders() {
|
||||||
if (!auth0.isAuthenticated.value) {
|
if (!auth0.isAuthenticated.value) {
|
||||||
return {};
|
return {} as Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const accessToken = await auth0.getAccessTokenSilently();
|
const accessToken = await auth0.getAccessTokenSilently();
|
||||||
return accessToken ? { Authorization: `Bearer ${accessToken}` } : {};
|
return accessToken ? { Authorization: `Bearer ${accessToken}` } : ({} as Record<string, string>);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getJson<T>(path: string, query?: Record<string, string | number | undefined | null>) {
|
export async function getJson<T>(path: string, query?: Record<string, string | number | undefined | null>) {
|
||||||
|
|||||||
@@ -15,5 +15,6 @@ if (import.meta.env.VITE_AUTH0_SCOPE) {
|
|||||||
export const auth0 = createAuth0({
|
export const auth0 = createAuth0({
|
||||||
domain: import.meta.env.VITE_AUTH0_DOMAIN,
|
domain: import.meta.env.VITE_AUTH0_DOMAIN,
|
||||||
clientId: import.meta.env.VITE_AUTH0_CLIENT_ID,
|
clientId: import.meta.env.VITE_AUTH0_CLIENT_ID,
|
||||||
|
cacheLocation: 'localstorage',
|
||||||
authorizationParams
|
authorizationParams
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Bundler",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user