Signup in hydrogen and redirect doesnot work #2287
Unanswered
Pankajmehta1998
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is my hydrogen code:
`import { Link, useFetcher } from '@remix-run/react';
import { useEffect, useState } from 'react';
export default function Register() {
const { Form, ...fetcher } = useFetcher();
const { data, state } = fetcher;
const [signupData, setSignupData] = useState({
firstName: "",
lastName: "",
Email: "",
Password: ""
});
const handleChange = (e: any) => {
const { name, value } = e.target;
setSignupData({
...signupData,
[name]: value
});
};
return (
CREATE ACCOUNT
)
}
this is my component code and
import { json, redirect, type ActionArgs } from '@shopify/remix-oxygen';import { CREATE_ACCOUNT } from '~/graphql/Mutation/Mutation';
export async function action({ context, request }: ActionArgs) {
const { storefront } = context;
const formData = await request.formData();
const firsName = formData.get('firstName') as string;
const lastName = formData.get('lastName') as string;
const email = formData.get('Email') as string;
const password = formData.get('Password') as string;
}
export function loader() {
return redirect('/account/register');
}` this is my api code
everything is working but redirect is not working here but when i am using it within conditions its working. I am trying to signup, account is getting created and all other conditions are working but redirect is not working.
Beta Was this translation helpful? Give feedback.
All reactions