-
Notifications
You must be signed in to change notification settings - Fork 6
/
wrapper.js
30 lines (26 loc) · 870 Bytes
/
wrapper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from "react"
import theme from "./src/styles/theme.js"
import { ThemeProvider } from "@material-ui/core/styles"
import { Provider } from "react-redux"
import { SnackbarProvider } from "notistack"
import store from "./src/store/index.js"
import { useDispatch } from "react-redux"
import { useAuthState } from "./src/utils/auth"
const AuthWrapper = ({ children }) => {
const dispatch = useDispatch();
useAuthState(dispatch);
return children
}
const RootWrapper = ({ children }) => {
return (
<Provider store={store}>
<SnackbarProvider anchorOrigin={{ vertical: "top", horizontal: "right" }}>
<ThemeProvider theme={theme}>
<AuthWrapper>{children}</AuthWrapper>
</ThemeProvider>
</SnackbarProvider>
</Provider>
)
}
const fun = ({ element }) => <RootWrapper>{element}</RootWrapper>
export default fun;