changes
This commit is contained in:
22
app/components/pos/composables/useCartData.js
Normal file
22
app/components/pos/composables/useCartData.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export default function useCartData() {
|
||||
const { $findapi, $getapi } = useNuxtApp();
|
||||
const carts = ref([]);
|
||||
const cartItems = ref([]);
|
||||
const customers = ref([]);
|
||||
const isPending = ref(false);
|
||||
|
||||
async function getCarts() {
|
||||
isPending.value = true;
|
||||
const apis = $findapi(["Cart", "Cart_Item", "customer"]);
|
||||
const [cartsRes, cartItemsRes, customersRes] = await $getapi(apis);
|
||||
isPending.value = false;
|
||||
|
||||
carts.value = cartsRes.data.rows || [];
|
||||
cartItems.value = cartItemsRes.data.rows || [];
|
||||
customers.value = customersRes.data.rows || [];
|
||||
}
|
||||
|
||||
onMounted(getCarts);
|
||||
|
||||
return { carts, cartItems, customers, getCarts, isPending };
|
||||
}
|
||||
Reference in New Issue
Block a user