Merge pull request 'package updated and remove unused packages' (#8) from fixes/code-refactor into develop
Reviewed-on: DigiMantra/digiev_frontend#8
This commit is contained in:
commit
3d48ee0509
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": {
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.0",
|
||||
"@mui/icons-material": "^6.3.0",
|
||||
"@mui/material": "^6.4.4",
|
||||
"@mui/x-charts": "^7.23.2",
|
||||
"@mui/x-data-grid": "^7.23.5",
|
||||
"@mui/icons-material": "^6.4.5",
|
||||
"@mui/material": "^6.4.5",
|
||||
"@mui/x-charts": "^7.27.0",
|
||||
"@mui/x-data-grid": "^7.27.0",
|
||||
"@mui/x-date-pickers": "^7.27.0",
|
||||
"@mui/x-tree-view": "^7.23.2",
|
||||
"@react-spring/web": "^9.7.5",
|
||||
"@reduxjs/toolkit": "^2.5.0",
|
||||
"@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",
|
||||
"axios": "^1.7.9",
|
||||
"clsx": "^2.1.1",
|
||||
"cra-template-typescript": "1.2.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"highcharts": "^12.1.2",
|
||||
"hooks": "file:@mui/x-charts/hooks",
|
||||
"mui-phone-number": "^3.0.3",
|
||||
"mui-tel-input": "^7.0.0",
|
||||
"prop-types": "^15.8.1",
|
||||
|
@ -42,7 +31,6 @@
|
|||
"react-router-dom": "^7.1.1",
|
||||
"react-scripts": "5.0.1",
|
||||
"sonner": "^1.7.4",
|
||||
"styles": "file:@mui/material/styles",
|
||||
"web-vitals": "^4.2.4"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
13611
pnpm-lock.yaml
13611
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........
|
||||
// const response = await http.post("admin/login", {
|
||||
|
||||
const response = await http.post("auth/login", {
|
||||
const response = await http.post("admin/login", {
|
||||
email,
|
||||
password,
|
||||
});
|
||||
|
|
|
@ -23,10 +23,6 @@ interface ProtectedRouteProps {
|
|||
component: React.ReactNode;
|
||||
}
|
||||
|
||||
interface SuperAdminRouteProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
// Protected Route Component
|
||||
const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ caps, component }) => {
|
||||
if (!localStorage.getItem("authToken")) {
|
||||
|
@ -35,18 +31,6 @@ const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ caps, 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
|
||||
export default function AppRouter() {
|
||||
return (
|
||||
|
@ -87,15 +71,11 @@ export default function AppRouter() {
|
|||
}
|
||||
/>
|
||||
<Route
|
||||
path="adminlist"
|
||||
path="admin-list"
|
||||
element={
|
||||
<ProtectedRoute
|
||||
caps={[]}
|
||||
component={
|
||||
<SuperAdminRoute>
|
||||
<AdminList />
|
||||
</SuperAdminRoute>
|
||||
}
|
||||
component={<AdminList />}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
@ -109,7 +89,6 @@ export default function AppRouter() {
|
|||
/>
|
||||
}
|
||||
/>
|
||||
<Route path="*" element={<>404</>} />
|
||||
</Route>
|
||||
|
||||
{/* Catch-all Route */}
|
||||
|
|
Loading…
Reference in a new issue