forked from summit-webapp-themes/elite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_app.tsx
73 lines (66 loc) · 2.15 KB
/
_app.tsx
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { Provider } from "react-redux";
// import "../styles/globals.css";
import type { AppProps } from "next/app";
import { persistor, store } from "../store/store";
import { PersistGate } from "redux-persist/integration/react";
import Layout from "../components/Layout";
import "../styles/globals.scss";
import ToastNotification from "../components/ToastNotification";
// import { initializeFirebase } from "../push-notifications";
// import { initializeFirebase } from '../public/service-worker';
import { useEffect } from "react";
import LogoutList from "../services/api/auth/logout_api";
function MyApp({ Component, pageProps }: AppProps) {
// initializeFirebase();
// useEffect(()=>
// {
// if ('serviceWorker' in navigator) {
// navigator.serviceWorker
// .register('/service-worker.js')
// .then((registration) => {
// console.log('Service Worker registered: ', registration);
// // registration.pushManager.subscribe({
// // userVisibleOnly: true,
// // // applicationServerKey,
// // })
// })
// .catch((error) => {
// console.error('Service Worker registration failed: ', error);
// });
// }
// },[])
// useEffect(() => {
// const handleBeforeUnload = async () => {
// localStorage.clear();
// const logoutAPI = await LogoutList();
// };
// window.addEventListener('beforeunload', handleBeforeUnload);
// return () => {
// window.removeEventListener('beforeunload', handleBeforeUnload);
// };
// }, []);
return (
// <div>
// <Layout>
// <Component {...pageProps} />
// {/* <Scrolltop articleRef={articleRef}/> */}
// </Layout>
// </div>
<div>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
{() => (
<div>
<Layout>
<ToastNotification />
<Component {...pageProps} />
{/* <Scrolltop articleRef={articleRef}/> */}
</Layout>
</div>
)}
</PersistGate>
</Provider>
</div>
);
}
export default MyApp;