dev-jaanvi #1
18924
package-lock.json
generated
18924
package-lock.json
generated
File diff suppressed because it is too large
Load diff
20
package.json
20
package.json
|
@ -5,31 +5,20 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.14.0",
|
"@emotion/react": "^11.14.0",
|
||||||
"@emotion/styled": "^11.14.0",
|
"@emotion/styled": "^11.14.0",
|
||||||
"@mui/icons-material": "^6.3.0",
|
"@mui/icons-material": "^6.4.5",
|
||||||
"@mui/material": "^6.4.4",
|
"@mui/material": "^6.4.5",
|
||||||
"@mui/x-charts": "^7.23.2",
|
"@mui/x-charts": "^7.27.0",
|
||||||
"@mui/x-data-grid": "^7.23.5",
|
"@mui/x-data-grid": "^7.27.0",
|
||||||
"@mui/x-date-pickers": "^7.27.0",
|
"@mui/x-date-pickers": "^7.27.0",
|
||||||
"@mui/x-tree-view": "^7.23.2",
|
|
||||||
"@react-spring/web": "^9.7.5",
|
"@react-spring/web": "^9.7.5",
|
||||||
"@reduxjs/toolkit": "^2.5.0",
|
"@reduxjs/toolkit": "^2.5.0",
|
||||||
"@types/babel__core": "^7.20.5",
|
"@types/babel__core": "^7.20.5",
|
||||||
"AdapterDayjs": "file:@mui/x-date-pickers/AdapterDayjs",
|
|
||||||
"AppBar": "file:@mui/material/AppBar",
|
|
||||||
"Box": "file:@mui/material/Box",
|
|
||||||
"PieChart": "file:@mui/x-charts/PieChart",
|
|
||||||
"RichTreeView": "file:@mui/x-tree-view/RichTreeView",
|
|
||||||
"Stack": "file:@mui/material/Stack",
|
|
||||||
"Tabs": "file:@mui/material/Tabs",
|
|
||||||
"Toolbar": "file:@mui/material/Toolbar",
|
|
||||||
"Typography": "file:@mui/material/Typography",
|
|
||||||
"add": "^2.0.6",
|
"add": "^2.0.6",
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cra-template-typescript": "1.2.0",
|
"cra-template-typescript": "1.2.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"highcharts": "^12.1.2",
|
"highcharts": "^12.1.2",
|
||||||
"hooks": "file:@mui/x-charts/hooks",
|
|
||||||
"mui-phone-number": "^3.0.3",
|
"mui-phone-number": "^3.0.3",
|
||||||
"mui-tel-input": "^7.0.0",
|
"mui-tel-input": "^7.0.0",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
|
@ -42,7 +31,6 @@
|
||||||
"react-router-dom": "^7.1.1",
|
"react-router-dom": "^7.1.1",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"sonner": "^1.7.4",
|
"sonner": "^1.7.4",
|
||||||
"styles": "file:@mui/material/styles",
|
|
||||||
"web-vitals": "^4.2.4"
|
"web-vitals": "^4.2.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
13449
pnpm-lock.yaml
13449
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -45,7 +45,7 @@ export const loginUser = createAsyncThunk<
|
||||||
//use below commented endpoint if using deployed backend........
|
//use below commented endpoint if using deployed backend........
|
||||||
// const response = await http.post("admin/login", {
|
// const response = await http.post("admin/login", {
|
||||||
|
|
||||||
const response = await http.post("auth/login", {
|
const response = await http.post("admin/login", {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,10 +23,6 @@ interface ProtectedRouteProps {
|
||||||
component: React.ReactNode;
|
component: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SuperAdminRouteProps {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protected Route Component
|
// Protected Route Component
|
||||||
const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ caps, component }) => {
|
const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ caps, component }) => {
|
||||||
if (!localStorage.getItem("authToken")) {
|
if (!localStorage.getItem("authToken")) {
|
||||||
|
@ -35,18 +31,6 @@ const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ caps, component }) => {
|
||||||
return <>{component}</>;
|
return <>{component}</>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Super Admin Route Component
|
|
||||||
const SuperAdminRoute: React.FC<SuperAdminRouteProps> = ({ children }) => {
|
|
||||||
const userRole = useSelector(
|
|
||||||
(state: RootState) => state.profileReducer.user?.role
|
|
||||||
);
|
|
||||||
|
|
||||||
if (userRole !== "superadmin") {
|
|
||||||
return <Navigate to="/panel/dashboard" replace />;
|
|
||||||
}
|
|
||||||
return <>{children}</>;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Combined Router Component
|
// Combined Router Component
|
||||||
export default function AppRouter() {
|
export default function AppRouter() {
|
||||||
return (
|
return (
|
||||||
|
@ -87,15 +71,11 @@ export default function AppRouter() {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="adminlist"
|
path="admin-list"
|
||||||
element={
|
element={
|
||||||
<ProtectedRoute
|
<ProtectedRoute
|
||||||
caps={[]}
|
caps={[]}
|
||||||
component={
|
component={<AdminList />}
|
||||||
<SuperAdminRoute>
|
|
||||||
<AdminList />
|
|
||||||
</SuperAdminRoute>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
@ -109,7 +89,6 @@ export default function AppRouter() {
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route path="*" element={<>404</>} />
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
{/* Catch-all Route */}
|
{/* Catch-all Route */}
|
||||||
|
|
Loading…
Reference in a new issue