Hi, Can you make supabase to not redirected user a...
# help
u
Hi, Can you make supabase to not redirected user anywhere on SignUp? I want my app to handle that
n
Hello @4Lajf! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
s
its for web or mobile app?
n
4Lajf (2022-03-31)
u
web app
s
you are using supabase js client?
u
yes
s
you have email confirmations on?
u
currently off for simplicity
s
okay, you can redirect the user depending upon the response in your front end app
u
thank you for the useful links. But i still don't know how to not redirect user anywhere because
Copy code
supabase.auth.signUp({
email: email,
password: password,
options: {
redirectTo: ''
}
});
Dosen't seem to work
as per
s
@User but that function on its own doesn't redirect the browser at all
s
Copy code
//something like this
const SignUp = () => {
  const router = useRouter();
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');

  const handleSubmit = async (e: React.FormEvent) => {
    e.preventDefault();

    const { error } = await supabase.auth.signUp({
      email,
      password,
    });

    if (error) {
      alert(JSON.stringify(error));
    } else {
      router.push('/signin');
    }
  };