Skip to content

Commit 1c1c8a5

Browse files
committed
switched back to 4 args
1 parent a70b880 commit 1c1c8a5

File tree

1 file changed

+4
-3
lines changed
  • frontend/src/components/utils

1 file changed

+4
-3
lines changed

frontend/src/components/utils/api.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)