@@ -18,6 +18,7 @@ export type Base44Client = ReturnType<typeof createClient>;
1818 * Create a Base44 client instance
1919 * @param {Object } config - Client configuration
2020 * @param {string } [config.serverUrl='https://base44.app'] - API server URL
21+ * @param {string } [config.appBaseUrl] - Application base URL
2122 * @param {string|number } config.appId - Application ID
2223 * @param {string } [config.token] - Authentication token
2324 * @param {string } [config.serviceToken] - Service role authentication token
@@ -26,24 +27,24 @@ export type Base44Client = ReturnType<typeof createClient>;
2627 */
2728export function createClient ( config : {
2829 serverUrl ?: string ;
30+ appBaseUrl ?: string ;
2931 appId : string ;
3032 token ?: string ;
3133 serviceToken ?: string ;
3234 requiresAuth ?: boolean ;
3335 functionsVersion ?: string ;
3436 headers ?: Record < string , string > ;
3537 options ?: CreateClientOptions ;
36- onRedirectToLogin ?: ( ) => void ;
3738} ) {
3839 const {
3940 serverUrl = "https://base44.app" ,
4041 appId,
4142 token,
4243 serviceToken,
4344 requiresAuth = false ,
45+ appBaseUrl,
4446 options,
4547 functionsVersion,
46- onRedirectToLogin,
4748 headers : optionalHeaders ,
4849 } = config ;
4950
@@ -75,50 +76,36 @@ export function createClient(config: {
7576 baseURL : `${ serverUrl } /api` ,
7677 headers,
7778 token,
78- requiresAuth,
79- appId,
80- serverUrl,
8179 onError : options ?. onError ,
82- onRedirectToLogin,
8380 } ) ;
8481
8582 const functionsAxiosClient = createAxiosClient ( {
8683 baseURL : `${ serverUrl } /api` ,
8784 headers : functionHeaders ,
8885 token,
89- requiresAuth,
90- appId,
91- serverUrl,
9286 interceptResponses : false ,
9387 onError : options ?. onError ,
94- onRedirectToLogin,
9588 } ) ;
9689
9790 const serviceRoleAxiosClient = createAxiosClient ( {
9891 baseURL : `${ serverUrl } /api` ,
9992 headers,
10093 token : serviceToken ,
101- serverUrl,
102- appId,
10394 onError : options ?. onError ,
104- onRedirectToLogin,
10595 } ) ;
10696
10797 const serviceRoleFunctionsAxiosClient = createAxiosClient ( {
10898 baseURL : `${ serverUrl } /api` ,
10999 headers : functionHeaders ,
110100 token : serviceToken ,
111- serverUrl,
112- appId,
113101 interceptResponses : false ,
114- onRedirectToLogin,
115102 } ) ;
116103
117104 const userModules = {
118105 entities : createEntitiesModule ( axiosClient , appId ) ,
119106 integrations : createIntegrationsModule ( axiosClient , appId ) ,
120107 auth : createAuthModule ( axiosClient , functionsAxiosClient , appId , {
121- onRedirectToLogin ,
108+ appBaseUrl ,
122109 serverUrl,
123110 } ) ,
124111 functions : createFunctionsModule ( functionsAxiosClient , appId ) ,
@@ -144,7 +131,7 @@ export function createClient(config: {
144131 socket,
145132 appId,
146133 serverUrl,
147- token
134+ token,
148135 } ) ,
149136 cleanup : ( ) => {
150137 socket . disconnect ( ) ;
0 commit comments