Skip to content

Commit

Permalink
fix deleted user
Browse files Browse the repository at this point in the history
  • Loading branch information
squi-ddy committed Oct 25, 2024
1 parent a2f652e commit 1383b15
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios";
import axios, { AxiosError } from "axios";
import { settings } from "./settings";
import { UserDetails } from "./types/user";
import { TopupDetails, TopupHistoryDetails, TopupToken } from "./types/topup";
Expand Down Expand Up @@ -26,6 +26,11 @@ export async function getUser(): Promise<UserDetails | null> {
const resp = await fetcher.get("/me");
return resp.data as UserDetails;
} catch (error) {
if ((error as AxiosError).response?.status === 500) {
// user probably got deleted
await logout();
return null;
}
return null;
}
}
Expand Down

0 comments on commit 1383b15

Please sign in to comment.