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

const ProductCartContext = createContext()

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

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

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