Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ilyasakin/d8df5515b728a65849c036fd0590e35f to your computer and use it in GitHub Desktop.
Save ilyasakin/d8df5515b728a65849c036fd0590e35f to your computer and use it in GitHub Desktop.
<template>
...
<Spinner :status="isLoading" />
...
</template>
<script setup lang="ts">
// imports ...
const isLoading = ref<boolean>(false);
const products = ref<IProduct[]>([]);
const cart = ref<ICartItem[]>([]);
const getProducts = async () => {
isLoading.value = true;
products.value = await productsService.getProducts();
isLoading.value = false;
};
const getCart = async () => {
isLoading.value = true;
cart.value = await cartService.getCartItems();
isLoading.value = false;
};
getProducts();
getCart();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment