diff --git a/src/lib/data.ts b/src/lib/data.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9cf2921b6209adffe5ca7c0913a27cc48bcd7d3 --- /dev/null +++ b/src/lib/data.ts @@ -0,0 +1,32 @@ +// import { GetPromotionStore, UserDetailsStore } from '$houdini'; +// import { pageIterator } from '$lib/graphql/query'; + +// type Promotion = unknown[]; + +// const cache = new Map<number, Promotion>(); + +// function fetchPromotion(promotion: number) { +// return Array.fromAsync(pageIterator(event, GetPromotionStore, { promotion })); +// } + +// export async function getPromotion(promo: number): Promise<Promotion> { +// if (cache.has(promo)) { +// return cache.get(promo)!; +// } +// const promotion = await fetchPromotion(promo); +// cache.set(promo, promotion); +// return promotion; +// } + +// export async function* promotionIterator( +// min: number, +// max: number +// ): AsyncGenerator<Promotion, void, unknown> { +// for (let i = min; i <= max; i++) { +// yield getPromotion(i); +// } +// } + +// export function getPromotionRange(min: number, max: number): Promise<Promotion> { +// return Array.fromAsync(promotionIterator(min, max)); +// }