diff --git a/src/auth/services/user-auth.service.ts b/src/auth/services/user-auth.service.ts index 085807a..ef47a5a 100644 --- a/src/auth/services/user-auth.service.ts +++ b/src/auth/services/user-auth.service.ts @@ -169,9 +169,12 @@ export class UserAuthService { const timeSinceLastOtp = differenceInSeconds(now, lastOtp.createdAt); if (timeSinceLastOtp < cooldown) { - throw new BadRequestException( - `Please wait ${cooldown - timeSinceLastOtp} more seconds before requesting a new OTP.`, - ); + throw new BadRequestException({ + message: `Please wait ${cooldown - timeSinceLastOtp} more seconds before requesting a new OTP.`, + data: { + cooldown: cooldown - timeSinceLastOtp, + }, + }); } } const otpCode = Math.floor(100000 + Math.random() * 900000).toString();