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

Function getBootData

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

Source from the content-addressed store, hash-verified

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

Callers 1

BootDataProviderFunction · 0.90

Calls 3

getStoredTcStringFunction · 0.90
getBootURLFunction · 0.85
enrichBootWithFeaturesFunction · 0.85

Tested by

no test coverage detected