diff --git a/src/apis/eduidSignup.ts b/src/apis/eduidSignup.ts index 15de97165..bc25f26e6 100644 --- a/src/apis/eduidSignup.ts +++ b/src/apis/eduidSignup.ts @@ -28,6 +28,10 @@ export interface SignupState { initiated_signup: boolean; is_logged_in: boolean; }; + name: { + given_name?: string; + surname?: string; + }; tou: { completed: boolean; version?: string }; captcha: { completed: boolean }; credentials: { diff --git a/src/components/Signup/SignupEnterCode.tsx b/src/components/Signup/SignupEnterCode.tsx index 0392c617d..cb2c48e05 100644 --- a/src/components/Signup/SignupEnterCode.tsx +++ b/src/components/Signup/SignupEnterCode.tsx @@ -1,4 +1,4 @@ -import { verifyEmailRequest } from "apis/eduidSignup"; +import { registerEmailRequest, verifyEmailRequest } from "apis/eduidSignup"; import EduIDButton from "components/Common/EduIDButton"; import { ResponseCodeButtons } from "components/Common/ResponseCodeAbortButton"; import { TimeRemainingWrapper } from "components/Common/TimeRemaining"; @@ -35,6 +35,22 @@ export function SignupEnterCode(): JSX.Element { setIsExpired(true); } + async function registerEmail() { + if (signupState?.email.address && signupState?.name?.given_name && signupState?.name?.surname) { + const res = await dispatch( + registerEmailRequest({ + email: signupState?.email.address, + given_name: signupState?.name?.given_name, + surname: signupState?.name?.surname, + }) + ); + + if (registerEmailRequest.fulfilled.match(res)) { + setIsExpired(false); + } + } + } + function handleAbortButtonOnClick(event: React.MouseEvent) { event.preventDefault(); signupContext.signupService.send({ type: "ABORT" }); @@ -81,18 +97,13 @@ export function SignupEnterCode(): JSX.Element {

- - + + ); diff --git a/src/tests/signup/SignupMain-test.tsx b/src/tests/signup/SignupMain-test.tsx index a24447685..92975cf7a 100644 --- a/src/tests/signup/SignupMain-test.tsx +++ b/src/tests/signup/SignupMain-test.tsx @@ -35,6 +35,10 @@ const emptyState: SignupState = { completed: false, version: "1999-v1", }, + name: { + given_name: "", + surname: "string", + }, user_created: false, }; const testFirstName = "test";