fix(routes): update key and redirect home to application (#342)

This commit is contained in:
Yash Joshi 2021-11-17 16:29:58 +05:30 committed by GitHub
parent da5bf3aea0
commit 43369bdefb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,10 @@
import NotFound from 'components/NotFound'; import NotFound from 'components/NotFound';
import Spinner from 'components/Spinner'; import Spinner from 'components/Spinner';
import ROUTES from 'constants/routes';
import AppLayout from 'container/AppLayout'; import AppLayout from 'container/AppLayout';
import history from 'lib/history'; import history from 'lib/history';
import React, { Suspense } from 'react'; import React, { Suspense } from 'react';
import { Route, Router, Switch } from 'react-router-dom'; import { Redirect, Route, Router, Switch, } from 'react-router-dom';
import routes from './routes'; import routes from './routes';
@ -12,12 +13,13 @@ const App = (): JSX.Element => (
<AppLayout> <AppLayout>
<Suspense fallback={<Spinner size="large" tip="Loading..." />}> <Suspense fallback={<Spinner size="large" tip="Loading..." />}>
<Switch> <Switch>
{routes.map(({ path, component, exact }, index) => { {routes.map(({ path, component, exact }) => {
return ( return (
<Route key={index} exact={exact} path={path} component={component} /> <Route key={path} exact={exact} path={path} component={component} />
); );
})} })}
<Route path="*" exact component={NotFound} /> <Redirect from="/" to={ROUTES.APPLICATION} />
<Route component={NotFound} />
</Switch> </Switch>
</Suspense> </Suspense>
</AppLayout> </AppLayout>