Skip to content

Commit

Permalink
added access token parsing error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Dec 3, 2024
1 parent 9e40847 commit 5c4ec67
Show file tree
Hide file tree
Showing 6 changed files with 346 additions and 8 deletions.
333 changes: 333 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/modules/components/card.module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { usePathname, useRouter } from "next/navigation";
import { UseGlobalTooltip } from "./tooltip";
import useCookie from "../utils/useCookie.module";
import ApiManager from "../utils/apiManager";
import { useConfigContext } from "@/app/workshop/ConfigContext";
import { useConfigContext } from "@/app/modules/utils/ConfigContext";


export const formatDate = (date: Date) => {
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions src/app/modules/utils/api.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ authApi.interceptors.request.use(async config => {
const error = new Error('No cookie');
return Promise.reject(error);
}

let valid = false;
try {
valid = checkAccess(sessionId);
} catch {
deleteCookie('sessionId');
}

if (checkAccess(sessionId)) {
await tokenMutex.acquire();
}
Expand Down
Loading

0 comments on commit 5c4ec67

Please sign in to comment.