chore: redirect user after payment gateway
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { createHmac } from "node:crypto";
|
||||
|
||||
import { BadRequestException, Injectable, Logger } from "@nestjs/common";
|
||||
import { BadRequestException, HttpStatus, Injectable, Logger } from "@nestjs/common";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
import { FastifyReply } from "fastify";
|
||||
import slugify from "slugify";
|
||||
@@ -159,6 +159,7 @@ export class UsersService {
|
||||
/************************************************************ */
|
||||
//TODO:fix this later
|
||||
async verifyEmail(queryDto: EmailVerifyQueryDto, rep: FastifyReply) {
|
||||
const frontUrl = this.configService.getOrThrow<string>("FRONT_URL");
|
||||
const { token, userId, ts } = queryDto;
|
||||
|
||||
const user = await this.userRepository.findOneBy({ id: userId });
|
||||
@@ -181,7 +182,7 @@ export class UsersService {
|
||||
await this.userRepository.save(user);
|
||||
|
||||
// return { message: UserMessage.EMAIL_VERIFIED };
|
||||
return rep.redirect("https://google.com");
|
||||
return rep.status(HttpStatus.FOUND).redirect(frontUrl);
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@@ -68,7 +68,6 @@ export class UsersController {
|
||||
/************************************************************ */
|
||||
|
||||
@ApiOperation({ summary: "Verify email" })
|
||||
@HttpCode(HttpStatus.PERMANENT_REDIRECT)
|
||||
@Get("verify-email")
|
||||
verifyEmail(@Query() queryDto: EmailVerifyQueryDto, @Res({ passthrough: true }) rep: FastifyReply) {
|
||||
return this.usersService.verifyEmail(queryDto, rep);
|
||||
|
||||
Reference in New Issue
Block a user