79443773

Date: 2025-02-16 19:15:25
Score: 2
Natty:
Report link

export const useProductsStore = defineStore("products", () => { const products = ref<TProduct[] | undefined>();

async function setProducts() { if (products.value !== undefined) return; // if it’s not necessary to block script execution here, use “then” instead of “await“ products.value = ( await fetchData( "https://dummyjson.com/products?limit=5" ) ).products; }

return { products, }; });

Reasons:
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Pierre Côté