forked from mosip/esignet-signup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: change query hook from verb to noun * chore: adapt naming convention * chore: use tanstack query and dev tool * fix: fix registration type imports * fix: resolve validate dom nesting * feat: check account status * fix: remove duplicates * feat: redirect user to next step * chore: rename type --------- Co-authored-by: Bunsy <[email protected]> Signed-off-by: Sreang Rathanak <[email protected]>
- Loading branch information
1 parent
71d544a
commit eb95e08
Showing
17 changed files
with
434 additions
and
268 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
signup-ui/src/pages/SignUpPage/AccountRegistrationStatus/AccountRegistrationStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { useEffect, useState } from "react"; | ||
import { UseFormReturn } from "react-hook-form"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
import { Icons } from "~components/ui/icons"; | ||
import { Step, StepContent, StepHeader, StepTitle } from "~components/ui/step"; | ||
import { RegistrationWithFailedStatus, SettingsDto } from "~typings/types"; | ||
|
||
import { useRegistrationStatus } from "../queries"; | ||
import { useSignUpContext } from "../SignUpContext"; | ||
import { SignUpForm } from "../SignUpPage"; | ||
|
||
interface StatusProps { | ||
settings: SettingsDto; | ||
methods: UseFormReturn<SignUpForm, any, undefined>; | ||
} | ||
|
||
export const AccountRegistrationStatus = ({ | ||
methods, | ||
settings, | ||
}: StatusProps) => { | ||
const { t } = useTranslation(); | ||
|
||
const { setActiveStep } = useSignUpContext(); | ||
const { trigger } = methods; | ||
|
||
const { data: registrationStatus, isError } = useRegistrationStatus( | ||
settings.response.configs["status.request.limit"], | ||
settings.response.configs["status.request.delay"] | ||
); | ||
|
||
useEffect(() => { | ||
if (isError) { | ||
setActiveStep((prevActiveStep) => prevActiveStep + 1); | ||
} | ||
|
||
if ( | ||
registrationStatus?.response.status === | ||
RegistrationWithFailedStatus.FAILED | ||
) { | ||
setActiveStep((prevActiveStep) => prevActiveStep + 1); | ||
} | ||
if ( | ||
registrationStatus?.response.status === | ||
RegistrationWithFailedStatus.COMPLETED | ||
) { | ||
setActiveStep((prevActiveStep) => prevActiveStep + 1); | ||
} | ||
}, [registrationStatus, settings.response.configs, isError, setActiveStep]); | ||
|
||
return ( | ||
<Step> | ||
<div className="p-16"> | ||
<StepHeader> | ||
<StepTitle> | ||
<Icons.loader className="h-20 w-20 animate-spin text-orange-500" /> | ||
</StepTitle> | ||
</StepHeader> | ||
<StepContent> | ||
<div className="flex flex-col items-center gap-4 px-4"> | ||
<h1 className="text-center text-2xl font-semibold"> | ||
{t("setup_progress")} | ||
</h1> | ||
<p className="text-center text-sm text-gray-500"> | ||
{t("setup_progress_wait")} | ||
</p> | ||
</div> | ||
</StepContent> | ||
</div> | ||
</Step> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
signup-ui/src/pages/SignUpPage/AccountRegistrationStatus/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { AccountRegistrationStatus as default } from "./AccountRegistrationStatus"; |
Oops, something went wrong.