Skip to content

Commit

Permalink
front end move locale into request body
Browse files Browse the repository at this point in the history
Signed-off-by: Mengleang <[email protected]>
  • Loading branch information
mengleang-ngoun committed Mar 15, 2024
1 parent 4b64cd0 commit b6320b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
10 changes: 6 additions & 4 deletions signup-ui/src/pages/shared/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand All @@ -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,
});

Expand Down
14 changes: 4 additions & 10 deletions signup-ui/src/pages/shared/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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);
};
2 changes: 2 additions & 0 deletions signup-ui/src/typings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export type RegistrationRequestDto = BaseRequestDto & {
username: string;
password: string;
consent: string;
locale: string;
userInfo: UserInfo;
};
};
Expand Down Expand Up @@ -234,6 +235,7 @@ export type ResetPasswordRequestDto = BaseRequestDto & {
request: {
identifier: string;
password: string;
locale: string;
};
};

Expand Down

0 comments on commit b6320b5

Please sign in to comment.