feat: Add frontend 401 unauthorized handling and update backend to async Rocket main.
This commit is contained in:
@@ -17,6 +17,10 @@ export const apiFetch = async (
|
||||
const response = await fetch(url, config);
|
||||
|
||||
if (!response.ok) {
|
||||
if (response.status == 401) {
|
||||
localStorage.removeItem("token");
|
||||
window.location.href = "/";
|
||||
}
|
||||
throw new Error(`Request failed with status ${response.status}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user