mirror of
https://github.com/songquanpeng/one-api.git
synced 2026-02-11 00:24:25 +08:00
Initial commit
This commit is contained in:
10
web/src/helpers/auth-header.js
Normal file
10
web/src/helpers/auth-header.js
Normal file
@@ -0,0 +1,10 @@
|
||||
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 {};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user