Fakultas Ilmu Komputer UI

Commit 005e915a authored by Jonathan Chandra's avatar Jonathan Chandra
Browse files

edit authHeader

parent d6c34cec
...@@ -20,7 +20,12 @@ export default new AuthService(); ...@@ -20,7 +20,12 @@ export default new AuthService();
export const authHeader = () => { export const authHeader = () => {
const user = JSON.parse(localStorage.getItem('user')); const user = JSON.parse(localStorage.getItem('user'));
return { Authorization: `Bearer ${user?.data?.token}` }; if (user.accessToken) {
return { Authorization: `Bearer ${user.accessToken}` };
}
else if (user.data.token) {
return { Authorization: `Bearer ${user.data.token}` };
}
}; };
export const loggedIn = JSON.parse(localStorage.getItem('user')) && 1; export const loggedIn = JSON.parse(localStorage.getItem('user')) && 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment