auth fixed
This commit is contained in:
@@ -6,7 +6,7 @@ import staffRoutes from './staffs'
|
|||||||
import pdfExtractionRoutes from './pdfExtraction';
|
import pdfExtractionRoutes from './pdfExtraction';
|
||||||
import claimsRoutes from './claims';
|
import claimsRoutes from './claims';
|
||||||
import insuranceCredsRoutes from './insuranceCreds';
|
import insuranceCredsRoutes from './insuranceCreds';
|
||||||
import documentRoutes from './documenets';
|
import documentRoutes from './documents';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const API_BASE_URL = import.meta.env.VITE_API_BASE_URL_BACKEND ?? "";
|
|||||||
|
|
||||||
async function throwIfResNotOk(res: Response) {
|
async function throwIfResNotOk(res: Response) {
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
const text = (await res.text()) || res.statusText;
|
|
||||||
|
|
||||||
if (res.status === 401 || res.status === 403) {
|
if (res.status === 401 || res.status === 403) {
|
||||||
localStorage.removeItem("token");
|
localStorage.removeItem("token");
|
||||||
@@ -14,7 +13,7 @@ async function throwIfResNotOk(res: Response) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Error(`${res.status}: ${text}`);
|
throw new Error(`${res.status}: ${res.statusText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user