anvil/striker-ui/pages/_app.tsx

35 lines
887 B
TypeScript
Raw Normal View History

import { AppProps } from 'next/app';
import { ThemeProvider } from '@mui/material';
import { CacheProvider, EmotionCache } from '@emotion/react';
import createEmotionCache from '../lib/create_emotion_cache/createEmotionCache';
import theme from '../theme';
2021-02-16 22:50:01 +00:00
import '../styles/globals.css';
import useSessionExpiryCheck from '../hooks/useSessionExpiryCheck';
const clientSideEmotionCache = createEmotionCache();
interface MyAppProps extends AppProps {
// eslint-disable-next-line react/require-default-props
emotionCache?: EmotionCache;
}
2021-02-16 22:50:01 +00:00
const App = ({
Component,
emotionCache = clientSideEmotionCache,
pageProps,
}: MyAppProps): JSX.Element => {
useSessionExpiryCheck();
return (
<CacheProvider value={emotionCache}>
<ThemeProvider theme={theme}>
<Component {...pageProps} />
</ThemeProvider>
</CacheProvider>
);
};
2021-02-16 22:50:01 +00:00
export default App;