UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

14 lines (13 loc) 453 B
import { useRpc } from "../core/useRpc.js"; export function useCurrentPromotions({ params, options } = {}, key = "useCurrentPromotions") { return useRpc("getCurrentPromotions", key, params, { getCachedData(cacheKey, nuxtApp) { const hydrationData = nuxtApp.isHydrating ? nuxtApp.payload.data[cacheKey] : nuxtApp.static.data[cacheKey]; return hydrationData ?? nuxtApp._asyncData[cacheKey]?.data.value; }, ...options }); }