mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
Add logout to error fallback
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user