Files
payload/src/auth/requestHandlers/verifyEmail.ts
James Mikrut 7083225abd Feat/remove this bindings (#629)
* feat: removes this bindings for cleaner, more maintainable code

Co-authored-by: Elliot DeNolf <denolfe@users.noreply.github.com>
Co-authored-by: Dan Ribbens <dan.ribbens@gmail.com>
2022-06-08 14:44:34 -04:00

23 lines
604 B
TypeScript

import { Response, NextFunction } from 'express';
import httpStatus from 'http-status';
import { PayloadRequest } from '../../express/types';
import verifyEmail from '../operations/verifyEmail';
async function verifyEmailHandler(req: PayloadRequest, res: Response, next: NextFunction): Promise<any> {
try {
await verifyEmail({
collection: req.collection,
token: req.params.token,
});
return res.status(httpStatus.OK)
.json({
message: 'Email verified successfully.',
});
} catch (error) {
return next(error);
}
}
export default verifyEmailHandler;