Unable to register users

I’m doing the React Native advanced concepts course, I’m on the Implementing the Registration video and I’m getting an undefined when printing out the result const.
Is this happening because we don’t have any “post” method on the client.js ?

Screenshot 2020-11-02 at 12.19.17

No post method

I faced the same error too. The quick fix could be to make sure your handleSubmit() looks exactly like this >>>

const handleSubmit = async (userInfo) => {

// userInfo is the object that formik gives us!

const result = await registerApi.request(userInfo);

if (!result.ok) {

  if (result.data) setError(result.data.error);

  else {

    setError("An unexpected error occurred.");

    console.log(result);

  }

  return;

}

// if registration is successful, log them in right away!

const { data: authToken } = await authApi.login(

  userInfo.email,

  userInfo.password

);

auth.logIn(authToken);

};

1 Like

Tagging on on this post if you don’t mind!

I had a different problem where I would get a response from the API saying “name” is required as an error message at the top of the form. Turns out I was missing …args in the apiFunc in useApi.js. Took me two hours to find it so I thought I’d share, because no one else here has had the same problem

Hello @ekbck , I’m still having this issue… May I know are there any other alternatives?

forexpave@gmail.com please send me message on this email

Hi guys,
I have the same issue: couldn’t register a new users: no any errors, nothing. How did you resolve this? Thank you!