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

Function getBootData

packages/shared/src/lib/boot.ts:157–180  ·  view source on GitHub ↗
({
  app,
  url,
  cookies,
  pathname,
}: GetBootDataParams)

Source from the content-addressed store, hash-verified

155}
156
157export async function getBootData({
158 app,
159 url,
160 cookies,
161 pathname,
162}: GetBootDataParams): Promise<Boot> {
163 const bootURL = getBootURL(app, url, pathname);
164 // Persisted by the CMP in the euconsent-v2 cookie on a previous page view —
165 // the CMP script loads after boot fires, so the live __tcfapi is never
166 // available here.
167 const tcString = getStoredTcString();
168 const res = await fetch(bootURL, {
169 method: 'GET',
170 credentials: 'include',
171 headers: {
172 app,
173 'Content-Type': 'application/json',
174 ...(tcString && { 'x-gdpr-consent': tcString }),
175 ...(cookies && { Cookie: cookies }),
176 },
177 });
178 const result = await res.json();
179 return enrichBootWithFeatures(result);
180}

Callers 1

BootDataProviderFunction · 0.90

Calls 3

getStoredTcStringFunction · 0.90
getBootURLFunction · 0.85
enrichBootWithFeaturesFunction · 0.85

Tested by

no test coverage detected