mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-11 22:17:14 +03:00
consistent return and sendStatus
This commit is contained in:
@@ -4,13 +4,12 @@ import {isUserVIP} from '../utils/isUserVIP';
|
||||
import {Request, Response} from 'express';
|
||||
import { HashedUserID, UserID } from '../types/user.model';
|
||||
|
||||
export async function getIsUserVIP(req: Request, res: Response): Promise<void> {
|
||||
export async function getIsUserVIP(req: Request, res: Response): Promise<Response> {
|
||||
const userID = req.query.userID as UserID;
|
||||
|
||||
if (userID == undefined) {
|
||||
//invalid request
|
||||
res.sendStatus(400);
|
||||
return;
|
||||
return res.sendStatus(400);
|
||||
}
|
||||
|
||||
//hash the userID
|
||||
@@ -18,14 +17,12 @@ export async function getIsUserVIP(req: Request, res: Response): Promise<void> {
|
||||
|
||||
try {
|
||||
const vipState = await isUserVIP(hashedUserID);
|
||||
res.status(200).json({
|
||||
return res.status(200).json({
|
||||
hashedUserID: hashedUserID,
|
||||
vip: vipState,
|
||||
});
|
||||
} catch (err) {
|
||||
Logger.error(err);
|
||||
res.sendStatus(500);
|
||||
|
||||
return;
|
||||
return res.sendStatus(500);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user