Skip to content

Commit

Permalink
Merge pull request #1910 from SUNET/eunju-new-session-signup
Browse files Browse the repository at this point in the history
Request fetchLogout when user is already signed up
  • Loading branch information
cartja authored Dec 3, 2024
2 parents 0e1177b + 160b7fa commit af8a8dc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/Signup/SignupApp.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useActor } from "@xstate/react";
import { fetchLogout } from "apis/eduidLogin";
import { fetchState } from "apis/eduidSignup";
import { RegisterEmail, SignupEmailForm } from "components/Signup/SignupEmailForm";
import { SignupGlobalStateContext } from "components/Signup/SignupGlobalState";
Expand Down Expand Up @@ -55,7 +56,11 @@ function SignupStart() {
async function fetchSignupState(): Promise<void> {
const response = await dispatch(fetchState());
if (fetchState.fulfilled.match(response)) {
if (response.payload.state?.email.address) {
if (response.payload.state.already_signed_up) {
dispatch(fetchLogout({}));
}
const { email } = response.payload.state || {};
if (email?.address) {
signupContext.signupService.send({ type: "BYPASS" });
} else signupContext.signupService.send({ type: "COMPLETE" });
}
Expand Down

0 comments on commit af8a8dc

Please sign in to comment.