1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import {Config} from 'sentry/types';
- import {extractSlug} from 'sentry/utils/extractSlug';
- const BOOTSTRAP_URL = '/api/client-config/';
- const bootApplication = (data: Config) => {
- window.csrfCookieName = data.csrfCookieName;
- window.superUserCookieName = data.superUserCookieName;
- window.superUserCookieDomain = data.superUserCookieDomain ?? undefined;
- return data;
- };
- async function bootWithHydration() {
- const response = await fetch(BOOTSTRAP_URL);
- const data: Config = await response.json();
-
-
-
- if (data.customerDomain === null && window.__SENTRY_DEV_UI) {
- const domain = extractSlug(window.location.host);
- if (domain) {
- data.customerDomain = {
- organizationUrl: `https://${domain.slug}.sentry.io`,
- sentryUrl: 'https://sentry.io',
- subdomain: domain.slug,
- };
- }
- }
- window.__initialData = data;
- return bootApplication(data);
- }
- export async function bootstrap() {
- const bootstrapData = window.__initialData;
-
-
-
- if (bootstrapData === undefined) {
- return await bootWithHydration();
- }
- return bootApplication(bootstrapData);
- }
|