Added login functionality for tech BOD-95

This commit is contained in:
Patrick Fic
2020-06-29 15:24:04 -07:00
parent 2edfadce3a
commit 0e9cc9620b
27 changed files with 552 additions and 115 deletions

View File

@@ -1,19 +1,16 @@
import { BackTop, Layout } from "antd";
import React, { lazy, Suspense, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { Route, Switch } from "react-router-dom";
import { connect } from "react-redux";
import { Redirect, Route, Switch } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import ErrorBoundary from "../../components/error-boundary/error-boundary.component";
import FcmNotification from "../../components/fcm-notification/fcm-notification.component";
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
import TechHeader from "../../components/tech-header/tech-header.component";
import TechSider from "../../components/tech-sider/tech-sider.component";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import "./tech.page.styles.scss";
const ManageRootPage = lazy(() =>
import("../manage-root/manage-root.page.container")
);
const JobsPage = lazy(() => import("../jobs/jobs.page"));
const TimeTicketModalContainer = lazy(() =>
import("../../components/time-ticket-modal/time-ticket-modal.container")
);
@@ -26,7 +23,14 @@ const TechLogin = lazy(() =>
const { Content } = Layout;
export default function TechPage({ match }) {
const mapStateToProps = createStructuredSelector({
technician: selectTechnician,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function TechPage({ technician, match }) {
const { t } = useTranslation();
useEffect(() => {
@@ -37,6 +41,7 @@ export default function TechPage({ match }) {
<Layout className='tech-layout-container'>
<TechSider />
<Layout>
{technician ? null : <Redirect to={`${match.path}/login`} />}
<TechHeader />
<Content className='tech-content-container'>
<FcmNotification />
@@ -48,11 +53,6 @@ export default function TechPage({ match }) {
<TimeTicketModalContainer />
<PrintCenterModalContainer />
<Switch>
<Route
exact
path={`${match.path}`}
component={ManageRootPage}
/>
<Route
exact
path={`${match.path}/login`}
@@ -68,3 +68,4 @@ export default function TechPage({ match }) {
</Layout>
);
}
export default connect(mapStateToProps, mapDispatchToProps)(TechPage);