fix: code not return

This commit is contained in:
Methapon2001 2024-07-02 17:45:21 +07:00
parent 33d5e6ef4c
commit 7782772e50

View file

@ -47,7 +47,11 @@ export async function keycloakAuth(request: Express.Request, roles?: string[]) {
if (Array.isArray(payload.roles) && Array.isArray(roles) && roles.length > 0) {
if (!roles.some((a: string) => payload.roles.includes(a))) {
throw new HttpError(HttpStatus.FORBIDDEN, "คุณไม่มีสิทธิในการเข้าถึงข้อมูลดังกล่าว");
throw new HttpError(
HttpStatus.FORBIDDEN,
"คุณไม่มีสิทธิในการเข้าถึงข้อมูลดังกล่าว",
"noPermission",
);
}
}