From b6320b52b0226af11861358b180f65896adacbf1 Mon Sep 17 00:00:00 2001 From: Mengleang Date: Fri, 15 Mar 2024 11:27:34 +0700 Subject: [PATCH] front end move locale into request body Signed-off-by: Mengleang --- signup-ui/src/pages/shared/mutations.ts | 10 ++++++---- signup-ui/src/pages/shared/service.ts | 14 ++++---------- signup-ui/src/typings/types.ts | 2 ++ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/signup-ui/src/pages/shared/mutations.ts b/signup-ui/src/pages/shared/mutations.ts index c47b44f7..6459ce43 100644 --- a/signup-ui/src/pages/shared/mutations.ts +++ b/signup-ui/src/pages/shared/mutations.ts @@ -65,8 +65,9 @@ export const useRegister = () => { RegistrationRequestDto >({ mutationKey: keys.registration, - mutationFn: (registrationRequestDto: RegistrationRequestDto) => - register(registrationRequestDto, locale), + mutationFn: (registrationRequestDto: RegistrationRequestDto) =>{ + registrationRequestDto.request.locale = locale + register(registrationRequestDto)}, gcTime: Infinity, }); @@ -83,8 +84,9 @@ export const useResetPassword = () => { ResetPasswordRequestDto >({ mutationKey: keys.resetPassword, - mutationFn: (resetPasswordRequestDto: ResetPasswordRequestDto) => - resetPassword(resetPasswordRequestDto, locale), + mutationFn: (resetPasswordRequestDto: ResetPasswordRequestDto) => { + resetPasswordRequestDto.request.locale = locale + resetPassword(resetPasswordRequestDto)}, gcTime: Infinity, }); diff --git a/signup-ui/src/pages/shared/service.ts b/signup-ui/src/pages/shared/service.ts index 1b87355b..c7f3156c 100644 --- a/signup-ui/src/pages/shared/service.ts +++ b/signup-ui/src/pages/shared/service.ts @@ -34,12 +34,9 @@ export const verifyChallenge = async ( }; export const register = async ( - register: RegistrationRequestDto, - locale: string + register: RegistrationRequestDto ) => { - return ApiService.post("/registration/register", register, { - headers: { locale: locale }, - }).then(({ data }) => data); + return ApiService.post("/registration/register", register).then(({ data }) => data); }; export const getRegistrationStatus = @@ -57,10 +54,7 @@ export const getRegistrationStatus = }; export const resetPassword = async ( - newUserInfo: ResetPasswordRequestDto, - locale: string + newUserInfo: ResetPasswordRequestDto ) => { - return ApiService.post("/reset-password", newUserInfo, { - headers: { local: locale }, - }).then(({ data }) => data); + return ApiService.post("/reset-password", newUserInfo).then(({ data }) => data); }; diff --git a/signup-ui/src/typings/types.ts b/signup-ui/src/typings/types.ts index e8530d9d..4dac3971 100644 --- a/signup-ui/src/typings/types.ts +++ b/signup-ui/src/typings/types.ts @@ -203,6 +203,7 @@ export type RegistrationRequestDto = BaseRequestDto & { username: string; password: string; consent: string; + locale: string; userInfo: UserInfo; }; }; @@ -234,6 +235,7 @@ export type ResetPasswordRequestDto = BaseRequestDto & { request: { identifier: string; password: string; + locale: string; }; };