feat: initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import MainLayout from "../layouts/mainLayout";
|
||||
import MinimalLayout from "../layouts/MinimalLayout";
|
||||
import ClinicsList from "../views/ClinicsList";
|
||||
import Dashboard from "../views/Dashboard";
|
||||
import StaffManagement from "../views/StaffManagement";
|
||||
import ClinicDetails from "../views/ClinicDetails";
|
||||
import Login from '../views/Login';
|
||||
import YourDetailsForm from "../views/Signup/YourDetailsForm";
|
||||
import MockPayment from "../views/MockPayment";
|
||||
import Users from "../views/User";
|
||||
import ClinicSetup from "../views/ClinicSetup";
|
||||
import ClinicTranscripts from "../views/ClinicTranscripts";
|
||||
|
||||
export const routesData = [
|
||||
{
|
||||
path: "/",
|
||||
layout: MainLayout,
|
||||
routes: [
|
||||
{ path: "/", component: Dashboard },
|
||||
{ path: "/clinics", component: ClinicsList },
|
||||
{ path: "/clinics/:id", component: ClinicDetails },
|
||||
{ path: "/admin", component: StaffManagement },
|
||||
{ path: "/doctor", component: Users },
|
||||
{ path: "/clinicSetup", component: ClinicSetup },
|
||||
{ path: "/transcripts", component: ClinicTranscripts },
|
||||
],
|
||||
isProtected: true,
|
||||
},
|
||||
{
|
||||
path: "/auth",
|
||||
layout: MinimalLayout,
|
||||
routes: [
|
||||
{ path: "/auth/login", component: Login },
|
||||
{ path: "/auth/signup/payment", component: MockPayment },
|
||||
{
|
||||
path: 'signup/your-details',
|
||||
component: YourDetailsForm,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,24 @@
|
||||
import React from "react";
|
||||
import { Navigate } from "react-router-dom";
|
||||
import {
|
||||
// checkModulePermission,
|
||||
// checkModulePermission,
|
||||
// getPortalType,
|
||||
// isCollageId,
|
||||
isLoggedIn,
|
||||
} from "../utils/share";
|
||||
import NotFound from "../views/NotFound";
|
||||
// import NotFound from '../views/NotFound';
|
||||
|
||||
export const withAuth = (Component, permission, isProtected) => (props) => {
|
||||
const isAuthenticated = isLoggedIn();
|
||||
if (isProtected && !isAuthenticated) {
|
||||
return <Navigate to={"/auth/login"} />;
|
||||
}
|
||||
|
||||
// if (!checkModulePermission(permission)) {
|
||||
// return <NotFound />;
|
||||
// }
|
||||
|
||||
return <Component {...props} />;
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
import React from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { Navigate } from "react-router-dom";
|
||||
import { CLINIC_STATUS } from "../constants";
|
||||
// import { isBSPortal } from "../utils/share";
|
||||
|
||||
// eslint-disable-next-line
|
||||
const withPermission = (Component) => (props) => {
|
||||
const companyStatus = useSelector(
|
||||
(state) => state?.login?.user?.company?.status
|
||||
);
|
||||
const { isBSAdmin } = false;
|
||||
// const { isBSAdmin } = isBSPortal();
|
||||
|
||||
// If the user is a BS Admin, render the component without any checks
|
||||
if (isBSAdmin === true) {
|
||||
return <Component {...props} />;
|
||||
}
|
||||
|
||||
if (companyStatus !== CLINIC_STATUS.APPROVED) {
|
||||
return <Navigate to="/" />;
|
||||
}
|
||||
|
||||
return <Component {...props} />;
|
||||
};
|
||||
|
||||
export default withPermission;
|
||||
Reference in New Issue
Block a user