From 8a1b298bed0925aa582f316c4d75ea8edfe1d7e9 Mon Sep 17 00:00:00 2001 From: nfesta2023 <142601504+nfesta2023@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:23:41 +0700 Subject: [PATCH] adjust api response (#3) Co-authored-by: NHT --- src/service/otp.service.ts | 6 ++++-- src/service/token.service.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/service/otp.service.ts b/src/service/otp.service.ts index dfc7473..67ec1cd 100644 --- a/src/service/otp.service.ts +++ b/src/service/otp.service.ts @@ -56,7 +56,8 @@ export class OtpService { // const response = await sendOTPSMS(phoneNumber, otpInfo.OTP); const response = otp; result.statusCode = 200; - result.message = response; + result.message = 'Request OTP successfully'; + result.data = response; return result; } catch (error) { result.statusCode = 500; @@ -95,7 +96,8 @@ export class OtpService { await this.tokenService.updateRefreshToken(user, tokenData.refresh_token); result.statusCode = 200; - result.message = tokenData; + result.message = 'Authenticate OTP successfully'; + result.data = tokenData; return result; } catch (error) { console.log(error); diff --git a/src/service/token.service.ts b/src/service/token.service.ts index 59c2424..3ff07f7 100644 --- a/src/service/token.service.ts +++ b/src/service/token.service.ts @@ -99,7 +99,8 @@ export class TokenService { this.updateRefreshToken(user, tokenData.refresh_token); result.statusCode = 200; - result.message = tokenData; + result.message = 'Refresh token successfully'; + result.data = tokenData; return result; } }