@@ -44,8 +44,11 @@ const fetchWithAuth = async (url: string, method: string = "GET", body: BodyInit
4444
4545 try {
4646 const apiUrl = getApiUrl ( ) ;
47-
48- const response = await fetch ( `${ apiUrl } ${ url } ` , options ) ;
47+ const finalUrl = `${ apiUrl } ${ url } ` ;
48+ console . log ( 'Final URL:' , finalUrl ) ;
49+ console . log ( 'Request Options:' , options ) ;
50+ // Log the request details
51+ const response = await fetch ( finalUrl , options ) ;
4952 console . log ( 'response' , response ) ;
5053
5154 if ( ! response . ok ) {
@@ -54,7 +57,10 @@ const fetchWithAuth = async (url: string, method: string = "GET", body: BodyInit
5457 }
5558
5659 const isJson = response . headers . get ( 'content-type' ) ?. includes ( 'application/json' ) ;
57- return isJson ? await response . json ( ) : null ;
60+ const responseData = isJson ? await response . json ( ) : null ;
61+
62+ console . log ( 'Response JSON:' , responseData ) ;
63+ return responseData ;
5864 } catch ( error ) {
5965 console . error ( 'API Error:' , ( error as Error ) . message ) ;
6066 throw error ;
@@ -81,7 +87,7 @@ const fetchWithoutAuth = async (url: string, method: string = "POST", body: Body
8187 const errorText = await response . text ( ) ;
8288 throw new Error ( errorText || 'Login failed' ) ;
8389 }
84-
90+ console . log ( 'response' , response ) ;
8591 const isJson = response . headers . get ( 'content-type' ) ?. includes ( 'application/json' ) ;
8692 return isJson ? await response . json ( ) : null ;
8793 } catch ( error ) {
0 commit comments