Added async validation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {Controller, Get} from '@overnightjs/core';
|
||||
import type {Request, Response} from 'express';
|
||||
import type {NextFunction, Request, Response} from 'express';
|
||||
|
||||
import {
|
||||
API_URI,
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import {prisma} from '../../database/prisma.js';
|
||||
import {jwt} from '../../middleware/auth.js';
|
||||
import {UserService} from '../../services/UserService.js';
|
||||
import {CatchAsync} from '../../utils/asyncHandler.js';
|
||||
|
||||
@Controller('google')
|
||||
export class Google {
|
||||
@@ -26,7 +27,8 @@ export class Google {
|
||||
}
|
||||
|
||||
@Get('callback')
|
||||
public async callback(req: Request, res: Response) {
|
||||
@CatchAsync
|
||||
public async callback(req: Request, res: Response, next: NextFunction) {
|
||||
if (!GOOGLE_OAUTH_ENABLED) {
|
||||
return res.status(404).json({error: 'Google OAuth is not configured'});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user