export const accessTokenKey: string = 'access_token';
export const asyncLocalStorage = {
setItem: async (value: string) => {
await null;
localStorage.setItem(accessTokenKey, value);
},
getItem: async () => {
await null;
return localStorage.getItem(accessTokenKey);
},
removeItem: async () => {
await null;
return localStorage.removeItem(accessTokenKey)
}
};
export const asyncApiClient = {
create: async () => {
return await axios.create({
baseURL: "http://localhost:8000/api",
responseType: "json",
headers: {
"Content-Type": "application/json",
Accept: 'application/json',
"Authorization": `Bearer ${await asyncLocalStorage.getItem()}`
},
});
}
}