增强后端 TypeScript 严格类型检查
This commit is contained in:
@@ -123,5 +123,13 @@ export function extractBearerToken(req: Request): string {
|
||||
})
|
||||
}
|
||||
|
||||
return matched[1]
|
||||
const token = matched[1]?.trim()
|
||||
if (!token) {
|
||||
throw createHttpError('未登录或登录已失效', {
|
||||
statusCode: 401,
|
||||
errorCode: 'admin_auth_required',
|
||||
})
|
||||
}
|
||||
|
||||
return token
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user