fix quantiti
This commit is contained in:
@@ -38,11 +38,16 @@ const Order: FC = () => {
|
|||||||
const productId = e.target.value
|
const productId = e.target.value
|
||||||
const product = data?.data?.find(o => Number(o.id) === Number(productId))
|
const product = data?.data?.find(o => Number(o.id) === Number(productId))
|
||||||
if (product) {
|
if (product) {
|
||||||
product.quantities.unshift(0)
|
if (product.quantities[0] !== 0) {
|
||||||
|
product.quantities.unshift(0)
|
||||||
|
}
|
||||||
setProductSelected(product)
|
setProductSelected(product)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(productSelected?.quantities);
|
||||||
|
|
||||||
|
|
||||||
// const handleChangeAttribute = (e: ChangeEvent<HTMLSelectElement>) => {
|
// const handleChangeAttribute = (e: ChangeEvent<HTMLSelectElement>) => {
|
||||||
// const attributeId = e.target.value
|
// const attributeId = e.target.value
|
||||||
// const attribute = productSelected?.attributes?.find(o => Number(o.id) === Number(attributeId))
|
// const attribute = productSelected?.attributes?.find(o => Number(o.id) === Number(attributeId))
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { create } from "zustand";
|
||||||
|
|
||||||
|
export const useAuthStore = create((set) => ({
|
||||||
|
phone: "",
|
||||||
|
setPhone(value) {
|
||||||
|
set({ phone: value });
|
||||||
|
},
|
||||||
|
}));
|
||||||
Reference in New Issue
Block a user