PromucFlow_constructor/app/client/src/pages/UserAuth/index.tsx

48 lines
1.7 KiB
TypeScript
Raw Normal View History

2019-12-16 08:49:10 +00:00
import React from "react";
import { Route, Switch, useLocation, useRouteMatch } from "react-router-dom";
import Login from "@appsmith/pages/UserAuth/Login";
import SignUp from "@appsmith/pages/UserAuth/SignUp";
2019-12-16 08:49:10 +00:00
import ForgotPassword from "./ForgotPassword";
import ResetPassword from "./ResetPassword";
import PageNotFound from "pages/common/ErrorPages/PageNotFound";
import * as Sentry from "@sentry/react";
import { requiresUnauth } from "./requiresAuthHOC";
import { useSelector } from "react-redux";
import { getThemeDetails, ThemeMode } from "selectors/themeSelectors";
import { AppState } from "@appsmith/reducers";
import { ThemeProvider } from "styled-components";
const SentryRoute = Sentry.withSentryRouting(Route);
export function UserAuth() {
2019-12-16 08:49:10 +00:00
const { path } = useRouteMatch();
const location = useLocation();
const lightTheme = useSelector((state: AppState) =>
getThemeDetails(state, ThemeMode.LIGHT),
);
return (
<ThemeProvider theme={lightTheme}>
<div className="absolute inset-0 flex flex-col overflow-y-auto auth-container bg-[color:var(--ads-color-background-secondary)] p-4 t--auth-container">
<Switch location={location}>
<SentryRoute component={Login} exact path={`${path}/login`} />
<SentryRoute component={SignUp} exact path={`${path}/signup`} />
<SentryRoute
component={ResetPassword}
exact
path={`${path}/resetPassword`}
/>
<SentryRoute
component={ForgotPassword}
exact
path={`${path}/forgotPassword`}
/>
<SentryRoute component={PageNotFound} />
</Switch>
</div>
</ThemeProvider>
2019-12-16 08:49:10 +00:00
);
}
2019-12-16 08:49:10 +00:00
export default requiresUnauth(UserAuth);