changes
This commit is contained in:
23
app/components/pos/composables/useCustomer.js
Normal file
23
app/components/pos/composables/useCustomer.js
Normal file
@@ -0,0 +1,23 @@
|
||||
export default function useCustomer({ activeCart, getCarts }) {
|
||||
const { $getdata, $patchapi } = useNuxtApp();
|
||||
|
||||
const addresses = ref([]);
|
||||
async function getAddresses() {
|
||||
addresses.value = await $getdata("Customer_Address", {
|
||||
filter: { customer: activeCart.value.customer },
|
||||
});
|
||||
}
|
||||
|
||||
const isChangingCus = ref(false);
|
||||
async function changeCustomer(cusId) {
|
||||
isChangingCus.value = true;
|
||||
const updatedCart = await $patchapi("Cart", {
|
||||
id: activeCart.value.id,
|
||||
customer: cusId,
|
||||
});
|
||||
await getCarts();
|
||||
isChangingCus.value = false;
|
||||
}
|
||||
|
||||
return { addresses, getAddresses, isChangingCus, changeCustomer };
|
||||
}
|
||||
Reference in New Issue
Block a user