mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-19 08:56:37 +08:00
11 lines
249 B
JavaScript
11 lines
249 B
JavaScript
export function authHeader() {
|
|
// return authorization header with jwt token
|
|
let user = JSON.parse(localStorage.getItem('user'));
|
|
|
|
if (user && user.token) {
|
|
return { Authorization: 'Bearer ' + user.token };
|
|
} else {
|
|
return {};
|
|
}
|
|
}
|