@@ -50,7 +50,6 @@ export const isErr = <T, E>(
5050
5151async function fetchAPIDevelopment < T = any , B extends object = any > (
5252 config : FetchOptions < B > ,
53- options ?: Partial < FetchOptionsWithSignal > ,
5453) : Promise < T & ResponseWithDetail > {
5554 // Generate a unique ID for this request
5655 // Create a promise that will resolve when we get a response with matching ID
@@ -101,34 +100,8 @@ async function fetchAPIDevelopment<T = any, B extends object = any>(
101100 } )
102101}
103102
104- function toRequestHeaders ( headers ?: Record < string , string > ) : HeadersInit {
105- return {
106- 'Content-Type' : 'application/json' ,
107- ...( headers ?? { } ) ,
108- }
109- }
110-
111- function toRequestBody ( obj : unknown ) : BodyInit {
112- try {
113- return JSON . stringify ( obj )
114- } catch ( error ) {
115- return ''
116- }
117- }
118-
119- function getUrlWithPrefix ( url : string = '/' ) : string {
120- let urlWithPrefix = `${ window . __BASE_URL__ ?? '/' } /${ url } `
121-
122- while ( urlWithPrefix . includes ( '//' ) ) {
123- urlWithPrefix = urlWithPrefix . replaceAll ( '//' , '/' )
124- }
125-
126- return urlWithPrefix
127- }
128-
129103export async function fetchAPIProduction < T = any , B extends object = any > (
130104 config : FetchOptions < B > ,
131- options ?: Partial < FetchOptionsWithSignal > ,
132105) : Promise < T & ResponseWithDetail > {
133106 // Generate a unique ID for this request
134107 const requestId = `query_${ Date . now ( ) } _${ Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 ) } `
@@ -180,10 +153,10 @@ export async function fetchAPIProduction<T = any, B extends object = any>(
180153
181154export function fetchAPI < T = any , B extends object = any > (
182155 config : FetchOptions < B > ,
183- options ?: Partial < FetchOptionsWithSignal > ,
156+ _options ?: Partial < FetchOptionsWithSignal > ,
184157) : Promise < T & ResponseWithDetail > {
185158 if ( IS_PRODUCTION ) {
186- return fetchAPIProduction ( config , options )
159+ return fetchAPIProduction ( config )
187160 }
188- return fetchAPIDevelopment ( config , options )
161+ return fetchAPIDevelopment ( config )
189162}
0 commit comments