summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2023-01-21 14:45:13 -0500
committerPuyodead1 <puyodead@protonmail.com>2023-02-23 22:40:05 -0500
commit97bafa81fc252c762aac265dc96eb90ec279cf96 (patch)
tree0195a31b08462d8aff7281783c126e6007cd7470 /src/api
parentUpdate package-lock.json (diff)
downloadserver-97bafa81fc252c762aac265dc96eb90ec279cf96.tar.xz
fix linting errors
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/auth/verify/index.ts15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/api/routes/auth/verify/index.ts b/src/api/routes/auth/verify/index.ts
index d61b8d16..7809bc26 100644
--- a/src/api/routes/auth/verify/index.ts
+++ b/src/api/routes/auth/verify/index.ts
@@ -17,11 +17,7 @@
 */
 
 import { route, verifyCaptcha } from "@fosscord/api";
-import {
-	Config,
-	FieldErrors,
-	verifyTokenEmailVerification,
-} from "@fosscord/util";
+import { checkToken, Config, FieldErrors } from "@fosscord/util";
 import { Request, Response, Router } from "express";
 import { HTTPError } from "lambert-server";
 const router = Router();
@@ -47,10 +43,7 @@ router.post(
 		try {
 			const { jwtSecret } = Config.get().security;
 
-			const { decoded, user } = await verifyTokenEmailVerification(
-				token,
-				jwtSecret,
-			);
+			const { decoded, user } = await checkToken(token, jwtSecret);
 
 			// toksn should last for 24 hours from the time they were issued
 			if (new Date().getTime() > decoded.iat * 1000 + 86400 * 1000) {
@@ -71,8 +64,8 @@ router.post(
 			// TODO: invalidate token after use?
 
 			return res.send(user);
-		} catch (error: any) {
-			throw new HTTPError(error?.toString(), 400);
+		} catch (error) {
+			throw new HTTPError((error as Error).toString(), 400);
 		}
 	},
 );