Add logout to error fallback

This commit is contained in:
jeffvli
2022-11-20 17:01:52 -08:00
parent b0f031bedc
commit de1e6c16c0
@@ -1,14 +1,18 @@
import { Box, Center, Group, Stack } from '@mantine/core';
import { FallbackProps } from 'react-error-boundary';
import { RiErrorWarningLine } from 'react-icons/ri';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import { Button, Text } from '@/renderer/components';
import { useAuthStore } from '@/renderer/store';
const Container = styled(Box)`
background: var(--main-bg);
`;
export const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => {
const logout = useAuthStore((state) => state.logout);
return (
<Container>
<Center sx={{ height: '100vh' }}>
@@ -21,6 +25,17 @@ export const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => {
<Button variant="filled" onClick={resetErrorBoundary}>
Reload
</Button>
<Button
component={Link}
to="/"
variant="filled"
onClick={() => {
logout();
}}
>
Log out
</Button>
</Stack>
</Center>
</Container>