File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,23 @@ import { hydrateRoot } from "react-dom/client";
44import { useLocation , useMatches } from "react-router" ;
55import { HydratedRouter } from "react-router/dom" ;
66
7- import { getPublicEnvVariables } from "cyberstorm/security/publicEnvVariables" ;
7+ import {
8+ getPublicEnvVariables ,
9+ getSessionTools ,
10+ } from "cyberstorm/security/publicEnvVariables" ;
811import { denyUrls } from "cyberstorm/utils/sentry" ;
12+ import { initializeClientDapper } from "cyberstorm/utils/dapperSingleton" ;
913
1014const publicEnvVariables = getPublicEnvVariables ( [
1115 "VITE_SITE_URL" ,
1216 "VITE_BETA_SITE_URL" ,
1317 "VITE_API_URL" ,
1418 "VITE_AUTH_BASE_URL" ,
1519 "VITE_CLIENT_SENTRY_DSN" ,
20+ "VITE_COOKIE_DOMAIN" ,
1621] ) ;
1722
23+ // TODO: Check if this is synchronous or not
1824Sentry . init ( {
1925 dsn : publicEnvVariables . VITE_CLIENT_SENTRY_DSN ,
2026 integrations : [
@@ -69,6 +75,16 @@ Sentry.init({
6975 denyUrls,
7076} ) ;
7177
78+ try {
79+ const sessionTools = getSessionTools ( publicEnvVariables ) ;
80+
81+ initializeClientDapper ( ( ) =>
82+ sessionTools . getConfig ( publicEnvVariables . VITE_API_URL )
83+ ) ;
84+ } catch ( error ) {
85+ Sentry . captureException ( error ) ;
86+ }
87+
7288startTransition ( ( ) => {
7389 hydrateRoot (
7490 document ,
Original file line number Diff line number Diff line change 11import { getSessionContext } from "@thunderstore/ts-api-react/src/SessionContext" ;
2- import { isRecord } from "cyberstorm /utils/typeChecks" ;
2+ import { isRecord } from ".. /utils/typeChecks" ;
33
44export type publicEnvVariablesKeys =
55 | "SITE_URL"
@@ -47,11 +47,10 @@ export function getPublicEnvVariables(
4747 return returnedVars ;
4848}
4949
50- export function getSessionTools ( ) {
51- const publicEnvVariables = getPublicEnvVariables ( [
52- "VITE_API_URL" ,
53- "VITE_COOKIE_DOMAIN" ,
54- ] ) ;
50+ export function getSessionTools ( preFetchedEnv ?: publicEnvVariablesType ) {
51+ const publicEnvVariables =
52+ preFetchedEnv ||
53+ getPublicEnvVariables ( [ "VITE_API_URL" , "VITE_COOKIE_DOMAIN" ] ) ;
5554 if (
5655 ! publicEnvVariables . VITE_API_URL ||
5756 ! publicEnvVariables . VITE_COOKIE_DOMAIN
You can’t perform that action at this time.
0 commit comments