Deal with missing pages

This commit is contained in:
Tanner Collin 2020-01-09 09:15:01 +00:00
parent 58a00f58a9
commit 3762f3458d

View File

@ -409,6 +409,7 @@ function TransactionDetail(props) {
const t = user.transactions.find(x => x.id == id); const t = user.transactions.find(x => x.id == id);
return ( return (
t ?
<Container> <Container>
<Header size='large'>Transaction Receipt</Header> <Header size='large'>Transaction Receipt</Header>
@ -450,6 +451,8 @@ function TransactionDetail(props) {
</Table> </Table>
</Container> </Container>
:
<NotFound />
); );
} }
@ -464,6 +467,17 @@ function PleaseLogin() {
); );
}; };
function NotFound() {
return (
<Container text>
<Message warning>
<Message.Header style={{ padding: 0 }}>The page you requested can't be found!</Message.Header>
<p>Visit our <Link to='/'>home page</Link> if you are lost.</p>
</Message>
</Container>
);
};
function App() { function App() {
const [token, setToken] = useState(localStorage.getItem('token', '')); const [token, setToken] = useState(localStorage.getItem('token', ''));
const [user, setUser] = useState(JSON.parse(localStorage.getItem('user', 'false'))); const [user, setUser] = useState(JSON.parse(localStorage.getItem('user', 'false')));
@ -563,6 +577,9 @@ function App() {
<Transactions user={user} /> <Transactions user={user} />
</Route> </Route>
<Route path='/:page'>
<NotFound />
</Route>
</Switch> </Switch>
: :
<Route path='/:page'> <Route path='/:page'>