config for oauth
This commit is contained in:
@@ -19,7 +19,11 @@ export async function fetchWithCache(url, cacheKey = url, cacheExpiry = 60) {
|
||||
}
|
||||
|
||||
try {
|
||||
const fetchPromise = fetch(url)
|
||||
const token = localStorage.getItem("accessToken");
|
||||
const headers = {
|
||||
...(token? {Authorization: `Bearer ${token}`} : {}),
|
||||
}
|
||||
const fetchPromise = fetch(url, {headers})
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
|
||||
Reference in New Issue
Block a user