summaryrefslogtreecommitdiff
path: root/src/contexts/ProductCartContext.js
blob: 19889e07e048dba069ca580b4ff152f967cc392b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { createContext, useCallback, useContext, useEffect, useState } from 'react'

const ProductCartContext = createContext()

export const ProductCartProvider = ({ children }) => {
  const [productCart, setProductCart] = useState(null)
  const [productQuotation, setProductQuotation] = useState(null)
  const [refreshQuotation, setRefreshQuotation] = useState(false)
  const [refreshCart, setRefreshCart] = useState(false)
  const [isLoading, setIsloading] = useState(false)

  return (
    <ProductCartContext.Provider
      value={{ productCart, setProductCart, refreshCart, setRefreshCart, isLoading, setIsloading, productQuotation, setProductQuotation, refreshQuotation, setRefreshQuotation }}
    >
      {children}
    </ProductCartContext.Provider>
  )
}

export const useProductCartContext = () => {
  return useContext(ProductCartContext)
}