summaryrefslogtreecommitdiff
path: root/src/pages/_app.jsx
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-09-21 14:56:35 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-09-21 14:56:35 +0700
commit4f285349adec93a040e41d1d8c0c1c7b57749397 (patch)
tree48d3f47c42f65a58b3a24c99410a52ade3f313ea /src/pages/_app.jsx
parent54b3b9670995d62c2e11b761911430e4300fa36e (diff)
add context for list product popup cart
Diffstat (limited to 'src/pages/_app.jsx')
-rw-r--r--src/pages/_app.jsx77
1 files changed, 40 insertions, 37 deletions
diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx
index ef737794..0062f7fc 100644
--- a/src/pages/_app.jsx
+++ b/src/pages/_app.jsx
@@ -11,12 +11,13 @@ import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner'
import { SessionProvider } from 'next-auth/react'
import { getAuth } from '@/core/utils/auth'
import { ProductProvider } from '@/contexts/ProductContext'
+import { ProductCartProvider } from '@/contexts/ProductCartContext'
const queryClient = new QueryClient()
export const AuthContext = createContext({
- authenticated : false,
- setAuthenticated : (auth) => {}
+ authenticated: false,
+ setAuthenticated: (auth) => {}
})
function MyApp({ Component, pageProps: { session, ...pageProps } }) {
@@ -63,43 +64,45 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }) {
return (
// <AuthContext.Provider value={{authenticated, setAuthenticated}}>
- <SessionProvider session={session}>
- <AnimatePresence>
- {animateLoader && (
- <motion.div
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- exit={{ opacity: 0 }}
- transition={{
- duration: 0.1
- }}
- className='fixed w-screen h-screen z-[500] bg-white flex justify-center items-center'
- >
- <LogoSpinner />
- </motion.div>
- )}
- </AnimatePresence>
- <Toaster
- position='top-center'
- containerStyle={toasterStyle}
- toastOptions={{
- duration: 3000,
- className: 'border border-gray_r-8'
- }}
- />
- <NextProgress color='#F01C21' options={{ showSpinner: false }} />
- <QueryClientProvider client={queryClient}>
- <AnimatePresence
- mode='popLayout'
- initial={false}
- onExitComplete={() => window.scrollTo(0, 0)}
+ <SessionProvider session={session}>
+ <AnimatePresence>
+ {animateLoader && (
+ <motion.div
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ exit={{ opacity: 0 }}
+ transition={{
+ duration: 0.1
+ }}
+ className='fixed w-screen h-screen z-[500] bg-white flex justify-center items-center'
>
- <ProductProvider>
+ <LogoSpinner />
+ </motion.div>
+ )}
+ </AnimatePresence>
+ <Toaster
+ position='top-center'
+ containerStyle={toasterStyle}
+ toastOptions={{
+ duration: 3000,
+ className: 'border border-gray_r-8'
+ }}
+ />
+ <NextProgress color='#F01C21' options={{ showSpinner: false }} />
+ <QueryClientProvider client={queryClient}>
+ <AnimatePresence
+ mode='popLayout'
+ initial={false}
+ onExitComplete={() => window.scrollTo(0, 0)}
+ >
+ <ProductProvider>
+ <ProductCartProvider>
{!animateLoader && <Component {...pageProps} key={router.asPath} />}
- </ProductProvider>
- </AnimatePresence>
- </QueryClientProvider>
- </SessionProvider>
+ </ProductCartProvider>
+ </ProductProvider>
+ </AnimatePresence>
+ </QueryClientProvider>
+ </SessionProvider>
// </AuthContext.Provider>
)
}