more work on testing
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { NextFunction, Request, Response } from "express"
|
||||
import { StatusCode } from "../util/types";
|
||||
|
||||
export function restrictAccess(req: Request, res: Response, next: NextFunction) {
|
||||
if (req.isAuthenticated()) {
|
||||
next();
|
||||
} else {
|
||||
res.send({ ok: false, user: undefined })
|
||||
res.status(StatusCode.Forbidden).send({ ok: false, user: undefined })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user