init: Init React Application

This commit is contained in:
2025-05-29 13:21:33 +03:00
parent 9444939507
commit 17de7e495f
66 changed files with 10425 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
export const decodeJWT = (token?: string): any | null => {
if (!token) {
console.error("No token provided");
return null;
}
try {
const base64Url = token.split(".")[1];
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
const jsonPayload = decodeURIComponent(
atob(base64)
.split("")
.map((c) => `%${("00" + c.charCodeAt(0).toString(16)).slice(-2)}`)
.join("")
);
const decodedPayload: any = JSON.parse(jsonPayload);
if (decodedPayload.exp && Date.now() >= decodedPayload.exp * 1000) {
return null;
}
return decodedPayload;
} catch {
return null;
}
};

2
src/shared/lib/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from "./mui/theme";
export * from "./DecodeJWT";

View File

@@ -0,0 +1,17 @@
import { createTheme } from "@mui/material/styles";
export const theme = createTheme({
// You can customize your theme here
palette: {
mode: "light",
},
components: {
MuiDrawer: {
styleOverrides: {
paper: {
backgroundColor: "#fff",
},
},
},
},
});