@@ -49,10 +49,6 @@ function createEntityHandler(
4949 entityName : string
5050) : EntityHandler {
5151 const baseURL = `/apps/${ appId } /entities/${ entityName } ` ;
52- const isDevMode = typeof window !== "undefined"
53- ? new URLSearchParams ( window . location . search ) . get ( "use_staging_db" ) === "true"
54- : false ;
55- const headers = { "X-Use-Staging-DB" : String ( isDevMode ) } ;
5652
5753 return {
5854 // List entities with optional pagination and sorting
@@ -64,7 +60,7 @@ function createEntityHandler(
6460 if ( fields )
6561 params . fields = Array . isArray ( fields ) ? fields . join ( "," ) : fields ;
6662
67- return axios . get ( baseURL , { params, headers } ) ;
63+ return axios . get ( baseURL , { params } ) ;
6864 } ,
6965
7066 // Filter entities based on query
@@ -85,37 +81,37 @@ function createEntityHandler(
8581 if ( fields )
8682 params . fields = Array . isArray ( fields ) ? fields . join ( "," ) : fields ;
8783
88- return axios . get ( baseURL , { params, headers } ) ;
84+ return axios . get ( baseURL , { params } ) ;
8985 } ,
9086
9187 // Get entity by ID
9288 async get ( id : string ) {
93- return axios . get ( `${ baseURL } /${ id } ` , { headers } ) ;
89+ return axios . get ( `${ baseURL } /${ id } ` ) ;
9490 } ,
9591
9692 // Create new entity
9793 async create ( data : Record < string , any > ) {
98- return axios . post ( baseURL , data , { headers } ) ;
94+ return axios . post ( baseURL , data ) ;
9995 } ,
10096
10197 // Update entity by ID
10298 async update ( id : string , data : Record < string , any > ) {
103- return axios . put ( `${ baseURL } /${ id } ` , data , { headers } ) ;
99+ return axios . put ( `${ baseURL } /${ id } ` , data ) ;
104100 } ,
105101
106102 // Delete entity by ID
107103 async delete ( id : string ) {
108- return axios . delete ( `${ baseURL } /${ id } ` , { headers } ) ;
104+ return axios . delete ( `${ baseURL } /${ id } ` ) ;
109105 } ,
110106
111107 // Delete multiple entities based on query
112108 async deleteMany ( query : Record < string , any > ) {
113- return axios . delete ( baseURL , { data : query , headers } ) ;
109+ return axios . delete ( baseURL , { data : query } ) ;
114110 } ,
115111
116112 // Create multiple entities in a single request
117113 async bulkCreate ( data : Record < string , any > [ ] ) {
118- return axios . post ( `${ baseURL } /bulk` , data , { headers } ) ;
114+ return axios . post ( `${ baseURL } /bulk` , data ) ;
119115 } ,
120116
121117 // Import entities from a file
@@ -125,7 +121,6 @@ function createEntityHandler(
125121
126122 return axios . post ( `${ baseURL } /import` , formData , {
127123 headers : {
128- ...headers ,
129124 "Content-Type" : "multipart/form-data" ,
130125 } ,
131126 } ) ;
0 commit comments