File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
frontend/src/components/utils Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,10 @@ export async function apiRequest(
3636 body = null ,
3737 token = null
3838) {
39- const authToken = token || getStoredToken ( ) ?. token ;
39+ const authToken = token || getStoredToken ( ) ?. token ; // Use provided token or get from localStorage
4040 const headers = {
4141 "Content-Type" : "application/json" ,
42- ...( authToken && { Authorization : `Bearer ${ authToken } ` } ) ,
42+ ...( authToken && { Authorization : `Bearer ${ authToken } ` } ) , // Conditionally add Authorization header
4343 } ;
4444
4545 const options = {
@@ -48,7 +48,8 @@ export async function apiRequest(
4848 ...( body && { body : JSON . stringify ( body ) } ) ,
4949 } ;
5050
51- console . log ( "Sending API request to:" , `${ API_BASE_URL } ${ endpoint } ` ) ;
51+ console . log ( "Sending API request to endpoint:" , `${ API_BASE_URL } ${ endpoint } ` ) ;
52+
5253 const response = await fetch ( `${ API_BASE_URL } ${ endpoint } ` , options ) ;
5354 return handleApiError ( response ) ;
5455}
You can’t perform that action at this time.
0 commit comments