product-card
Some checks failed
Deploy / build-and-deploy (push) Failing after 9s

This commit is contained in:
Veselov
2025-09-21 01:27:48 +03:00
parent e2ebf54d56
commit 9b42223a97
10 changed files with 99 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
export * from './useCart'
export * from './useCurrentProduct'
export * from './useProduct'
export * from './useProductsList'

19
composables/useCart.ts Normal file
View File

@@ -0,0 +1,19 @@
export const useCart = () => {
const addToCart = (item: any) => {
if (process.client) {
localStorage.setItem('cart', JSON.stringify(item))
}
}
const getCart = () => {
if (process.client) {
return localStorage.getItem('cart')
}
return null
}
return {
addToCart,
getCart,
}
}