1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

fix: use router match util (#298)

This commit is contained in:
Fredrik Strand Oseberg 2021-05-18 12:10:57 +02:00 committed by GitHub
parent a9d9a54bee
commit 960801b8aa

View File

@ -1,20 +1,26 @@
import ConditionallyRender from '../../common/ConditionallyRender'; import ConditionallyRender from '../../common/ConditionallyRender';
import { matchPath } from 'react-router';
import MainLayout from '../MainLayout'; import MainLayout from '../MainLayout';
const LayoutPicker = ({ children, location }) => { const LayoutPicker = ({ children, location }) => {
const standalonePages = () => { const standalonePages = () => {
const isLoginPage = location.pathname.includes('login'); const { pathname } = location;
const isNewUserPage = location.pathname.includes('new-user'); const isLoginPage = matchPath(pathname, { path: '/login' });
const isChangePasswordPage = location.pathname.includes( const isNewUserPage = matchPath(pathname, {
'reset-password' path: '/new-user',
); });
const isResetPasswordSuccessPage = location.pathname.includes( const isChangePasswordPage = matchPath(pathname, {
'reset-password-success' path: '/reset-password',
); });
const isForgottenPasswordPage = location.pathname.includes( const isResetPasswordSuccessPage = matchPath(pathname, {
'forgotten-password' path: '/reset-password-success',
); });
const is404 = location.pathname.includes('404');
const isForgottenPasswordPage = matchPath(pathname, {
path: '/forgotten-password',
});
const is404 = matchPath(pathname, { path: '/404' });
return ( return (
isLoginPage || isLoginPage ||