import useDefaultStore from "~/hooks/pinia/useDefaultStore" export default async function cachedPromise(key: string, promise: () =>Promise): Promise { const cache = useDefaultStore().getCache(key) if (cache) { return cache } const res = await promise() useDefaultStore().setCache(key, res) return res }