Skip to content

Commit

Permalink
fix: auth refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeldking committed Sep 5, 2024
1 parent b6cb4a8 commit b36cb92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/authFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export async function authFetch(
input: RequestInfo | URL,
init?: RequestInit
): Promise<Response> {
// eslint-disable-next-line no-console
console.log("authFetch");
try {
return await fetch(input, init).then((response) => {
if (response.status === 401) {
Expand Down Expand Up @@ -50,7 +48,9 @@ async function refreshTokens(url: string = REFRESH_URL): Promise<Response> {
method: "POST",
}).then((response) => {
if (!response.ok) {
throw new Error("Failed to refresh tokens");
// for now force redirect to login page. This could re-throw with a custom error
// But for now, we'll just redirect
window.location.href = "/login";
}
// Clear the refreshPromise so that future requests will trigger a new refresh
refreshPromise = null;
Expand Down

0 comments on commit b36cb92

Please sign in to comment.