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() {
|
||||
if (!auth0.isAuthenticated.value) {
|
||||
return {};
|
||||
return {} as Record<string, string>;
|
||||
}
|
||||
|
||||
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>) {
|
||||
|
||||
@@ -15,5 +15,6 @@ if (import.meta.env.VITE_AUTH0_SCOPE) {
|
||||
export const auth0 = createAuth0({
|
||||
domain: import.meta.env.VITE_AUTH0_DOMAIN,
|
||||
clientId: import.meta.env.VITE_AUTH0_CLIENT_ID,
|
||||
cacheLocation: 'localstorage',
|
||||
authorizationParams
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"moduleResolution": "Bundler",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"resolveJsonModule": true,
|
||||
|
||||
Reference in New Issue
Block a user