safe navigate in user vip

This commit is contained in:
Ajay
2022-05-27 19:07:44 -04:00
parent 6621ae3730
commit 0260b4889d

View File

@@ -2,5 +2,5 @@ import { db } from "../databases/databases";
import { HashedUserID } from "../types/user.model";
export async function isUserVIP(userID: HashedUserID): Promise<boolean> {
return (await db.prepare("get", `SELECT count(*) as "userCount" FROM "vipUsers" WHERE "userID" = ? LIMIT 1`, [userID])).userCount > 0;
return (await db.prepare("get", `SELECT count(*) as "userCount" FROM "vipUsers" WHERE "userID" = ? LIMIT 1`, [userID]))?.userCount > 0;
}