diff --git a/govtool/frontend/src/components/organisms/RegisterAsdRepStepThree.tsx b/govtool/frontend/src/components/organisms/RegisterAsdRepStepThree.tsx index 5fd57ad08..6b5a3df4d 100644 --- a/govtool/frontend/src/components/organisms/RegisterAsdRepStepThree.tsx +++ b/govtool/frontend/src/components/organisms/RegisterAsdRepStepThree.tsx @@ -18,10 +18,19 @@ export const RegisterAsdRepStepThree = ({ }) => { const { t } = useTranslation(); const { isMobile } = useScreenDimension(); - const { control, errors, submitForm, isRegistrationAsDRepLoading, watch } = - useRegisterAsdRepFormContext(); + const { + control, + errors, + isRegistrationAsDRepLoading, + resetField, + submitForm, + watch, + } = useRegisterAsdRepFormContext(); - const onClickBackButton = () => setStep(2); + const onClickBackButton = () => { + setStep(2); + resetField("storeData"); + }; const isContinueDisabled = !watch("storeData"); @@ -30,7 +39,7 @@ export const RegisterAsdRepStepThree = ({ return ( { const { t } = useTranslation(); const { isMobile } = useScreenDimension(); - const { control, errors,isContinueButtonDisabled, isSkipButton } = useRegisterAsdRepFormContext(); + const { control, errors, isContinueButtonDisabled, isSkipButton } = + useRegisterAsdRepFormContext(); const onClickContinue = useCallback(() => setStep(3), []); diff --git a/govtool/frontend/src/hooks/forms/useRegisterAsdRepFormContext.tsx b/govtool/frontend/src/hooks/forms/useRegisterAsdRepFormContext.tsx index 575e4ce6a..504680a0e 100644 --- a/govtool/frontend/src/hooks/forms/useRegisterAsdRepFormContext.tsx +++ b/govtool/frontend/src/hooks/forms/useRegisterAsdRepFormContext.tsx @@ -22,12 +22,13 @@ export const useRegisterAsdRepFormContext = () => { control, handleSubmit, formState: { errors, isValid }, + resetField, watch, } = useFormContext(); - const isSkipButton = !watch('hash')?.trim() && !watch("url")?.trim() + const isSkipButton = !watch("hash")?.trim() && !watch("url")?.trim(); - const isContinueButtonDisabled = !!Object.keys(errors).length + const isContinueButtonDisabled = !!Object.keys(errors).length; const onSubmit = useCallback( async (values: UrlAndHashFormValues) => { @@ -92,13 +93,14 @@ export const useRegisterAsdRepFormContext = () => { ); return { - isRegistrationAsDRepLoading: isLoading, control, errors, - isValid, isContinueButtonDisabled, + isRegistrationAsDRepLoading: isLoading, isSkipButton, - watch, + isValid, + resetField, submitForm: handleSubmit(onSubmit), + watch, }; }; diff --git a/govtool/frontend/src/i18n/locales/en.ts b/govtool/frontend/src/i18n/locales/en.ts index b6a35cbb6..f205ffcca 100644 --- a/govtool/frontend/src/i18n/locales/en.ts +++ b/govtool/frontend/src/i18n/locales/en.ts @@ -433,11 +433,12 @@ export const en = { nextStep: "Next step", no: "No", ok: "Ok", - select: "Select", + register:"Register", seeTransaction: "See transaction", - submit: "Submit", + select: "Select", skip: "Skip", sortBy: "Sort by", + submit: "Submit", thisLink: "this link", votingPower: "Voting power:", yes: "Yes",