MCPcopy Create free account
hub / github.com/dailydotdev/apps / fetchAdRequest

Function fetchAdRequest

packages/shared/src/lib/ads.ts:49–63  ·  view source on GitHub ↗
({
  path,
  params,
}: {
  path: string;
  params?: URLSearchParams;
})

Source from the content-addressed store, hash-verified

47};
48
49const fetchAdRequest = async ({
50 path,
51 params,
52}: {
53 path: string;
54 params?: URLSearchParams;
55}): Promise<Ad | null> => {
56 const query = params?.toString();
57 const res = await fetch(`${apiUrl}${path}${query ? `?${query}` : ''}`, {
58 credentials: 'include',
59 });
60
61 const ads = (await res.json()) as Ad[];
62 return addGenerationIdHeader({ ad: ads[0], res });
63};
64
65export const resolveAdFetchOptions = ({
66 placement = AdPlacement.Feed,

Callers 2

fetchAdByPlacementFunction · 0.85
fetchAdFunction · 0.85

Calls 1

addGenerationIdHeaderFunction · 0.85

Tested by

no test coverage detected