Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(consent): add different functionality for cancel button on login. #4423

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/consent/app/login/email-login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React from "react"

import { useFormState } from "react-dom"
import { useRouter } from "next/navigation"
import { toast } from "react-toastify"

import InputComponent from "../../components/input-component"
Expand All @@ -23,6 +24,8 @@ interface LoginProps {
}

const EmailLoginForm = ({ login_challenge }: LoginProps) => {
const router = useRouter()

const [state, formAction] = useFormState<LoginEmailResponse, FormData>(submitForm, {
error: false,
message: null,
Expand Down Expand Up @@ -73,11 +76,12 @@ const EmailLoginForm = ({ login_challenge }: LoginProps) => {
Next
</PrimaryButton>
<SecondaryButton
type="submit"
type="button"
id="reject"
name="submit"
name="cancel"
value={SubmitValue.denyAccess}
formNoValidate
onClick={() => router.back()}
>
Cancel
</SecondaryButton>
Expand Down
7 changes: 5 additions & 2 deletions apps/consent/components/phone-auth/phone-auth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import SelectComponent from "@/components/select"
import RegisterLink from "@/components/register-link"

import { GetCaptchaChallengeResponse } from "@/app/types/phone-auth.types"
import { useRouter } from "next/navigation"

interface AuthFormProps {
authAction: "Register" | "Login"
Expand All @@ -46,6 +47,7 @@ const PhoneAuthForm: React.FC<AuthFormProps> = ({
countryCodes,
authAction,
}) => {
const router = useRouter()
const [phoneNumber, setPhoneNumber] = useState<string>("")
const [state, formAction] = useFormState<GetCaptchaChallengeResponse, FormData>(
getCaptchaChallenge,
Expand Down Expand Up @@ -156,11 +158,12 @@ const PhoneAuthForm: React.FC<AuthFormProps> = ({
Next
</PrimaryButton>
<SecondaryButton
type="submit"
type="button"
id="reject"
name="submit"
name="cancel"
value={SubmitValue.denyAccess}
formNoValidate
onClick={() => router.back()}
>
Cancel
</SecondaryButton>
Expand Down