summary refs log tree commit diff
path: root/api/src/middlewares/Authentication.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-31 18:10:36 +0200
committerGitHub <noreply@github.com>2021-08-31 18:10:36 +0200
commitf654635d6a93e47255069d16b2f45b2f0a460d8b (patch)
treecfec2fdf2a37066197937dbca32ceb89a038477b /api/src/middlewares/Authentication.ts
parentCreated list of all possible api errors and made them throwable in routes code (diff)
parentMerge branch 'typeorm' of https://github.com/fosscord/fosscord-api into typeorm (diff)
downloadserver-f654635d6a93e47255069d16b2f45b2f0a460d8b.tar.xz
Merge branch 'typeorm' into typeorm
Diffstat (limited to 'api/src/middlewares/Authentication.ts')
-rw-r--r--api/src/middlewares/Authentication.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/api/src/middlewares/Authentication.ts b/api/src/middlewares/Authentication.ts

index 34a66a6b..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; } } } @@ -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)); } }