We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe803eb commit 57a0ad3Copy full SHA for 57a0ad3
src/api/api.js
@@ -22,14 +22,18 @@ const commonAPICall = async (
22
'Content-Type': 'application/json',
23
},
24
) => {
25
+ const token = tokenLocalStorage();
26
const FULLPATH = BASE_URL + PATH;
27
+ if (token) {
28
+ headers = {
29
+ ...headers,
30
+ Authorization: `Bearer ${token}`,
31
+ };
32
+ }
33
const response = await fetch(FULLPATH, {
34
method: METHOD,
35
body: BODY,
- headers: {
- ...headers,
- Authorization: `Bearer ${tokenLocalStorage()}`,
- },
36
+ headers: headers,
37
});
38
39
return response;
0 commit comments