better not found
This commit is contained in:
@@ -7,6 +7,7 @@ import { useUser } from './data/User';
|
||||
import Dashboard from './views/Dashboard';
|
||||
import Login from './views/Login';
|
||||
import Logout from './views/Logout';
|
||||
import NotFound from './views/NotFound';
|
||||
import CreateFirstUser from './views/CreateFirstUser';
|
||||
import MediaLibrary from './views/MediaLibrary';
|
||||
import Edit from './views/collections/Edit';
|
||||
@@ -110,7 +111,7 @@ const Routes = () => {
|
||||
}}
|
||||
/>
|
||||
<Route>
|
||||
<h1>Not Found</h1>
|
||||
<NotFound />
|
||||
</Route>
|
||||
</Switch>
|
||||
);
|
||||
|
||||
@@ -9,8 +9,10 @@ const cookies = new Cookies();
|
||||
const Context = createContext({});
|
||||
|
||||
const UserProvider = ({ children }) => {
|
||||
const cookieToken = cookies.get('token');
|
||||
|
||||
const [token, setToken] = useState('');
|
||||
const [user, setUser] = useState(null);
|
||||
const [user, setUser] = useState(cookieToken ? jwtDecode(cookieToken) : null);
|
||||
|
||||
useEffect(() => {
|
||||
if (token) {
|
||||
|
||||
24
src/client/components/views/NotFound/index.js
Normal file
24
src/client/components/views/NotFound/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
import getSanitizedConfig from '../../../config/getSanitizedConfig';
|
||||
import Button from '../../controls/Button';
|
||||
import DefaultTemplate from '../../layout/DefaultTemplate';
|
||||
|
||||
const { routes: { admin } } = getSanitizedConfig();
|
||||
|
||||
const NotFound = () => {
|
||||
return (
|
||||
<DefaultTemplate className="not-found">
|
||||
<h1>Nothing found</h1>
|
||||
<p>Sorry—there is nothing to correspond with your request.</p>
|
||||
<br />
|
||||
<Button
|
||||
el="link"
|
||||
to={`${admin}`}
|
||||
>
|
||||
Back to Dashboard
|
||||
</Button>
|
||||
</DefaultTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default NotFound;
|
||||
Reference in New Issue
Block a user