lint fixes

This commit is contained in:
Hammad 2023-10-24 16:26:53 +05:00
parent f2c6321216
commit 4b0b91396b

View File

@ -17,13 +17,15 @@ export default class BearerTokenAuthorization {
try {
req = req as OneUptimeRequest;
if (req.headers?.['authorization'] || req.headers?.['Authorization']) {
if (
req.headers?.['authorization'] ||
req.headers?.['Authorization']
) {
let token: string | undefined | Array<string> =
req.headers['authorization'] ||
req.headers['Authorization'];
token = token?.toString().replace('Bearer ', '');
if (token) {
const tokenData: JSONObject =
JSONWebToken.decodeJsonPayload(token);
@ -33,7 +35,9 @@ export default class BearerTokenAuthorization {
}
}
throw new NotAuthorizedException('Invalid bearer token, or bearer token not provided.');
throw new NotAuthorizedException(
'Invalid bearer token, or bearer token not provided.'
);
} catch (err) {
next(err);
}