guardian routes
This commit is contained in:
parent
f2ad6b43bd
commit
78f2b34810
@ -9,9 +9,11 @@ import {
|
||||
} from "react-router-dom";
|
||||
|
||||
import { getNotification } from "@redux/outstaffingSlice";
|
||||
import { Notification } from "@components/Notification/Notification";
|
||||
|
||||
import { MainPage } from "@pages/MainPage/MainPage";
|
||||
|
||||
import { Notification } from "@components/Notification/Notification";
|
||||
|
||||
import "assets/fonts/stylesheet.css";
|
||||
import "assets/global.scss";
|
||||
|
||||
|
@ -92,7 +92,7 @@ export const ProfileHeader = () => {
|
||||
}, []);
|
||||
|
||||
const handler = (e) => {
|
||||
e.preventDefault()
|
||||
e.preventDefault();
|
||||
localStorage.clear();
|
||||
dispatch(auth(false));
|
||||
navigate("/auth");
|
||||
|
@ -1,23 +1,22 @@
|
||||
import React from "react";
|
||||
import { useMemo } from "react";
|
||||
import { PartnerPage } from "@pages/roles/PartnerPage";
|
||||
import { DeveloperPage } from "@pages/roles/DeveloperPage";
|
||||
import { GuestPage } from "@pages/roles/GuestPage";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { selectAuth } from "@redux/outstaffingSlice";
|
||||
|
||||
import { DeveloperPage } from "@pages/roles/DeveloperPage";
|
||||
import { GuestPage } from "@pages/roles/GuestPage";
|
||||
import { PartnerPage } from "@pages/roles/PartnerPage";
|
||||
|
||||
export const MainPage = () => {
|
||||
const roleId = localStorage.getItem("role_status")
|
||||
const roleId = localStorage.getItem("role_status");
|
||||
const isAuth = useSelector(selectAuth);
|
||||
const user_roles = {
|
||||
developer: 4,
|
||||
partner: 18
|
||||
}
|
||||
};
|
||||
|
||||
const CurrentRolePage = useMemo(
|
||||
() => getRolePage(Number(roleId)),
|
||||
[isAuth]
|
||||
);
|
||||
const CurrentRolePage = useMemo(() => getRolePage(Number(roleId)), [isAuth]);
|
||||
|
||||
function getRolePage(roleId) {
|
||||
switch (roleId) {
|
||||
@ -30,7 +29,5 @@ export const MainPage = () => {
|
||||
}
|
||||
}
|
||||
|
||||
return(
|
||||
<CurrentRolePage />
|
||||
)
|
||||
}
|
||||
return <CurrentRolePage />;
|
||||
};
|
||||
|
@ -65,10 +65,7 @@ export const PartnerCategories = () => {
|
||||
{
|
||||
label: "Резюме",
|
||||
renderCell: (item) => (
|
||||
<Link
|
||||
className="table__link"
|
||||
to={`/candidate/${item.user_id}`}
|
||||
>
|
||||
<Link className="table__link" to={`/candidate/${item.user_id}`}>
|
||||
Резюме
|
||||
</Link>
|
||||
)
|
||||
|
@ -1,44 +1,38 @@
|
||||
import React from "react";
|
||||
import { Navigate, Route, Routes } from "react-router-dom";;
|
||||
import { Navigate, Route, Routes } from "react-router-dom";
|
||||
|
||||
import { PartnerSettings } from "@pages/PartnerSettings/PartnerSettings";
|
||||
import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties";
|
||||
import { Payouts } from "@pages/Payouts/Payouts";
|
||||
import { Profile } from "@pages/Profile/Profile";
|
||||
import { ProfileCalendar } from "@components/ProfileCalendar/ProfileCalendar";
|
||||
import { ReportForm } from "@components/ReportForm/ReportForm";
|
||||
import { ViewReport } from "@pages/ViewReport/ViewReport";
|
||||
import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker";
|
||||
import { PassingTests } from "@pages/Quiz/PassingTests";
|
||||
import { QuizPage } from "@pages/Quiz/QuizPage";
|
||||
import { QuizReportPage } from "@pages/Quiz/QuizReportPage";
|
||||
import Statistics from "@pages/Statistics/Statistics";
|
||||
import { Summary } from "@pages/Summary/Summary";
|
||||
import { Tracker } from "@pages/Tracker/Tracker";
|
||||
import Statistics from "@pages/Statistics/Statistics";
|
||||
import { Payouts } from "@pages/Payouts/Payouts";
|
||||
import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties";
|
||||
import { QuizPage } from "@pages/Quiz/QuizPage";
|
||||
import { PassingTests } from "@pages/Quiz/PassingTests";
|
||||
import { QuizReportPage } from "@pages/Quiz/QuizReportPage";
|
||||
import { PartnerSettings } from "@pages/PartnerSettings/PartnerSettings";
|
||||
import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker";
|
||||
import { ViewReport } from "@pages/ViewReport/ViewReport";
|
||||
|
||||
import { TicketFullScreen } from "@components/Modal/Tracker/TicketFullScreen/TicketFullScreen";
|
||||
import { ProfileCalendar } from "@components/ProfileCalendar/ProfileCalendar";
|
||||
import { ReportForm } from "@components/ReportForm/ReportForm";
|
||||
|
||||
export const DeveloperPage = () => {
|
||||
return(
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
exact
|
||||
path="/tracker/task/:id"
|
||||
element={<TicketFullScreen />}
|
||||
></Route>
|
||||
<Route
|
||||
exact
|
||||
path="/tracker/project/:id"
|
||||
element={<ProjectTracker />}
|
||||
/>
|
||||
<Route exact path="/tracker/project/:id" element={<ProjectTracker />} />
|
||||
|
||||
<Route exact path="profile">
|
||||
<Route index element={<Profile />} />
|
||||
<Route exact path="calendar" element={<ProfileCalendar />} />
|
||||
<Route exact path="calendar/report" element={<ReportForm />} />
|
||||
<Route
|
||||
exact
|
||||
path="calendar/view/:date/:id"
|
||||
element={<ViewReport />}
|
||||
/>
|
||||
<Route exact path="calendar/view/:date/:id" element={<ViewReport />} />
|
||||
<Route exact path="summary" element={<Summary />} />
|
||||
<Route exact path="tracker" element={<Tracker />} />
|
||||
<Route exact path="statistics/:id" element={<Statistics />} />
|
||||
@ -53,5 +47,5 @@ export const DeveloperPage = () => {
|
||||
</Route>
|
||||
<Route path="*" element={<Navigate to="/profile" replace />} />
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -1,25 +1,27 @@
|
||||
import React from "react";
|
||||
import { Navigate, Route, Routes } from "react-router-dom";
|
||||
import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro";
|
||||
import { TrackerAuth } from "@pages/TrackerAuth/TrackerAuth";
|
||||
import { Forms } from "@pages/Forms/Forms";
|
||||
import { TrackerRegistration } from "@pages/TrackerRegistration/TrackerRegistration";
|
||||
import { CompanyInfo } from "@pages/CompanyInfo/CompanyInfo";
|
||||
import { RegistrationSetting } from "@pages/RegistrationSetting/RegistrationSetting";
|
||||
import CatalogSpecialists from "@pages/CatalogSpecialists/CatalogSpecialists";
|
||||
import { FreeDevelopers } from "@components/FreeDevelopers/FreeDevelopers";
|
||||
import { AuthForCandidate } from "@pages/AuthForCandidate/AuthForCandidate";
|
||||
import { RegistrationForCandidate } from "@pages/RegistrationForCandidate/RegistrationForCandidate";
|
||||
import { FrequentlyAskedQuestions } from "@pages/FrequentlyAskedQuestions/FrequentlyAskedQuestions";
|
||||
import { Blog } from "@pages/Blog/Blog";
|
||||
|
||||
import { Article } from "@pages/Article/Article";
|
||||
import { FrequentlyAskedQuestion } from "@pages/FrequentlyAskedQuestion/FrequentlyAskedQuestion";
|
||||
import { SingleReportPage } from "@pages/SingleReportPage/SingleReportPage";
|
||||
import { ProfileCandidate } from "@pages/ProfileCandidate/ProfileCandidate";
|
||||
import { Auth } from "@pages/Auth/Auth";
|
||||
import { AuthForCandidate } from "@pages/AuthForCandidate/AuthForCandidate";
|
||||
import { Blog } from "@pages/Blog/Blog";
|
||||
import CatalogSpecialists from "@pages/CatalogSpecialists/CatalogSpecialists";
|
||||
import { CompanyInfo } from "@pages/CompanyInfo/CompanyInfo";
|
||||
import { Forms } from "@pages/Forms/Forms";
|
||||
import { FrequentlyAskedQuestion } from "@pages/FrequentlyAskedQuestion/FrequentlyAskedQuestion";
|
||||
import { FrequentlyAskedQuestions } from "@pages/FrequentlyAskedQuestions/FrequentlyAskedQuestions";
|
||||
import { ProfileCandidate } from "@pages/ProfileCandidate/ProfileCandidate";
|
||||
import { RegistrationForCandidate } from "@pages/RegistrationForCandidate/RegistrationForCandidate";
|
||||
import { RegistrationSetting } from "@pages/RegistrationSetting/RegistrationSetting";
|
||||
import { SingleReportPage } from "@pages/SingleReportPage/SingleReportPage";
|
||||
import { TrackerAuth } from "@pages/TrackerAuth/TrackerAuth";
|
||||
import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro";
|
||||
import { TrackerRegistration } from "@pages/TrackerRegistration/TrackerRegistration";
|
||||
|
||||
import { FreeDevelopers } from "@components/FreeDevelopers/FreeDevelopers";
|
||||
|
||||
export const GuestPage = () => {
|
||||
return(
|
||||
return (
|
||||
<Routes>
|
||||
<Route exact path="/auth" element={<Auth />} />
|
||||
<Route path="*" element={<Navigate to="/auth" replace />} />
|
||||
@ -68,5 +70,5 @@ export const GuestPage = () => {
|
||||
<Route index element={<ProfileCandidate />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -1,26 +1,28 @@
|
||||
import React from "react";
|
||||
import { Navigate, Route, Routes } from "react-router-dom";
|
||||
import { Candidate } from "@components/Candidate/Candidate";
|
||||
|
||||
import { FormPage } from "@pages/FormPage/FormPage";
|
||||
import { Calendar } from "@components/Calendar/Calendar";
|
||||
import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker";
|
||||
import { TicketFullScreen } from "@components/Modal/Tracker/TicketFullScreen/TicketFullScreen";
|
||||
import { Profile } from "@pages/Profile/Profile";
|
||||
import { Home } from "@pages/Home/Home";
|
||||
import { ViewReport } from "@pages/ViewReport/ViewReport";
|
||||
import { Tracker } from "@pages/Tracker/Tracker";
|
||||
import Statistics from "@pages/Statistics/Statistics";
|
||||
import { PartnerRequests } from "@pages/PartnerRequests/PartnerRequests";
|
||||
import { PartnerAddRequest } from "@pages/PartnerAddRequest/PartnerAddRequest";
|
||||
import { PartnerBid } from "@pages/PartnerBid/PartnerBid";
|
||||
import { PartnerCategories } from "@pages/PartnerСategories/PartnerСategories";
|
||||
import { PartnerEmployeeReport } from "@pages/PartnerEmployeeReport/PartnerEmployeeReport";
|
||||
import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties";
|
||||
import { PartnerEmployees } from "@pages/PartnerEmployees/PartnerEmployees";
|
||||
import { PartnerRequests } from "@pages/PartnerRequests/PartnerRequests";
|
||||
import { PartnerSettings } from "@pages/PartnerSettings/PartnerSettings";
|
||||
import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties";
|
||||
import { PartnerCategories } from "@pages/PartnerСategories/PartnerСategories";
|
||||
import { Profile } from "@pages/Profile/Profile";
|
||||
import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker";
|
||||
import Statistics from "@pages/Statistics/Statistics";
|
||||
import { Tracker } from "@pages/Tracker/Tracker";
|
||||
import { ViewReport } from "@pages/ViewReport/ViewReport";
|
||||
|
||||
import { Calendar } from "@components/Calendar/Calendar";
|
||||
import { Candidate } from "@components/Candidate/Candidate";
|
||||
import { TicketFullScreen } from "@components/Modal/Tracker/TicketFullScreen/TicketFullScreen";
|
||||
|
||||
export const PartnerPage = () => {
|
||||
return(
|
||||
return (
|
||||
<Routes>
|
||||
<Route exact path="/candidate/:id" element={<Candidate />} />
|
||||
<Route exact path="/candidate/:id/form" element={<FormPage />} />
|
||||
@ -31,20 +33,12 @@ export const PartnerPage = () => {
|
||||
path="/tracker/task/:id"
|
||||
element={<TicketFullScreen />}
|
||||
></Route>
|
||||
<Route
|
||||
exact
|
||||
path="/tracker/project/:id"
|
||||
element={<ProjectTracker />}
|
||||
/>
|
||||
<Route exact path="/tracker/project/:id" element={<ProjectTracker />} />
|
||||
|
||||
<Route exact path="profile">
|
||||
<Route index element={<Profile />} />
|
||||
<Route exact path="catalog" element={<Home />} />
|
||||
<Route
|
||||
exact
|
||||
path="calendar/view/:date/:id"
|
||||
element={<ViewReport />}
|
||||
/>
|
||||
<Route exact path="calendar/view/:date/:id" element={<ViewReport />} />
|
||||
<Route exact path="tracker" element={<Tracker />} />
|
||||
<Route exact path="statistics/:id" element={<Statistics />} />
|
||||
<Route exact path="settings" element={<PartnerSettings />} />
|
||||
@ -67,5 +61,5 @@ export const PartnerPage = () => {
|
||||
</Route>
|
||||
<Route path="*" element={<Navigate to="/profile" replace />} />
|
||||
</Routes>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user