1 files changed, 5 insertions, 5 deletions
diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts
index a8bfe196..a300c786 100644
--- a/api/src/middlewares/Authentication.ts
+++ b/api/src/middlewares/Authentication.ts
@@ -18,9 +18,9 @@ export const API_PREFIX_TRAILING_SLASH = /^\/api(\/v\d+)?\//;
declare global {
namespace Express {
interface Request {
- user_id: any;
+ user_id: string;
user_bot: boolean;
- token: any;
+ token: string;
}
}
}
@@ -28,7 +28,7 @@ declare global {
export async function Authentication(req: Request, res: Response, next: NextFunction) {
if (req.method === "OPTIONS") return res.sendStatus(204);
const url = req.url.replace(API_PREFIX, "");
- if (url.startsWith("/invites") && req.method === "GET") return next(); // @ts-ignore
+ if (url.startsWith("/invites") && req.method === "GET") return next();
if (
NO_AUTHORIZATION_ROUTES.some((x) => {
if (typeof x === "string") return url.startsWith(x);
@@ -47,7 +47,7 @@ export async function Authentication(req: Request, res: Response, next: NextFunc
req.user_id = decoded.id;
req.user_bot = user.bot;
return next();
- } catch (error) {
- return next(new HTTPError(error.toString(), 400));
+ } catch (error: any) {
+ return next(new HTTPError(error?.toString(), 400));
}
}
|