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

Function fetchAdRequest

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

Source from the content-addressed store, hash-verified

74};
75
76const fetchAdRequest = async ({
77 path,
78 params,
79}: {
80 path: string;
81 params?: URLSearchParams;
82}): Promise<Ad | null> => {
83 const query = params?.toString();
84 const res = await fetch(`${apiUrl}${path}${query ? `?${query}` : ''}`, {
85 credentials: 'include',
86 });
87
88 const ads = (await res.json()) as Ad[];
89 return addGenerationIdHeader({ ad: ads[0], res });
90};
91
92export const resolveAdFetchOptions = ({
93 placement = AdPlacement.Feed,

Callers 2

fetchAdByPlacementFunction · 0.85
fetchAdFunction · 0.85

Calls 1

addGenerationIdHeaderFunction · 0.85

Tested by

no test coverage detected