2023-03-12 18:17:28 +00:00
|
|
|
// project import
|
|
|
|
import Routes from './routes';
|
2023-03-13 21:06:19 +00:00
|
|
|
import * as React from 'react';
|
2023-03-12 18:17:28 +00:00
|
|
|
import ThemeCustomization from './themes';
|
|
|
|
import ScrollTop from './components/ScrollTop';
|
2023-03-13 21:06:19 +00:00
|
|
|
import Snackbar from '@mui/material/Snackbar';
|
|
|
|
import {Alert} from '@mui/material';
|
|
|
|
|
|
|
|
import { setSnackit } from './api/wrap';
|
|
|
|
|
2023-03-12 18:17:28 +00:00
|
|
|
// ==============================|| APP - THEME, ROUTER, LOCAL ||============================== //
|
|
|
|
|
|
|
|
const App = () => {
|
2023-03-13 21:06:19 +00:00
|
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
const [message, setMessage] = React.useState('');
|
|
|
|
setSnackit((message) => {
|
|
|
|
setMessage(message);
|
|
|
|
setOpen(true);
|
|
|
|
})
|
2023-03-12 18:17:28 +00:00
|
|
|
return (
|
|
|
|
<ThemeCustomization>
|
2023-03-13 21:06:19 +00:00
|
|
|
<Snackbar
|
|
|
|
open={open}
|
|
|
|
autoHideDuration={5000}
|
|
|
|
onClose={() => {setOpen(false)}}
|
|
|
|
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
|
|
|
|
>
|
|
|
|
<Alert className={open ? 'shake' : ''} severity="error" sx={{ width: '100%' }}>
|
|
|
|
{message}
|
|
|
|
</Alert>
|
|
|
|
</Snackbar>
|
2023-03-12 18:17:28 +00:00
|
|
|
<ScrollTop>
|
|
|
|
<Routes />
|
|
|
|
</ScrollTop>
|
|
|
|
</ThemeCustomization>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|