修复token验证

This commit is contained in:
hanhh
2021-06-30 12:20:42 +08:00
parent ef16622a7e
commit 0c3b3c206e
2 changed files with 11 additions and 2 deletions
+8
View File
@@ -111,3 +111,11 @@ export function createRandomString(min: number, max: number): string {
return newArr.join('');
}
export function getToken(req: any) {
const { authorization } = req.headers;
if (authorization && authorization.split(' ')[0] === 'Bearer') {
return authorization.split(' ')[1];
}
return '';
}