0

I have this password reset function here which works perfectly fine on desktop in all browsers.

const onFormSubmit = async (e) => {
  e.preventDefault();

  if (!email || !email.includes('@') ) {
      setErrMessage('Die eingegebenen Daten sind fehlerhaft')
      return;
  }

  const data = {
    email: email
  }


  try{
    const res = await axios.post(`${baseurl}/api/auth/password-reset/`, data, {
      headers: {'Content-type':'application/json'}
    })

    setMessage(res.data.message)
    setErrMessage('')

    //Await for data for any desirable next steps
    //const data = await res.json();
    // console.log(data);
  }catch(error){
    const e = error.response.data.message
    setErrMessage(e)
    setMessage('')
    return
  }
};

Now I just switched to my iPhone on safari and tried to reset the password by filling in the information and clicking on the button, but nothing happens. Installing google browser on my iPhone repeating this also works perfectly fine so the problem has to do with safari mobile..

Does anybody has an idea? The whole function seems to not getting called at all.

T.Trassoudaine
  • 1,242
  • 7
  • 13
Marcel Dz
  • 2,321
  • 4
  • 14
  • 49
  • 2
    I suggest you take a look at your safari console (if you did not already but your post makes no mention of it). Meanwhile, you should check how `axios.post()` is supposed to work on Safari, it seems that other browsers have less requirements. For example, from what I found, removing the `/` at the end of the URL could help: https://stackoverflow.com/a/47209376/1292776 – T.Trassoudaine Oct 12 '21 at 10:28
  • how to access the safari console on my mobile phone? Using or removing the / and the end of the url sadly doesnt make any difference. It both doesnt work – Marcel Dz Oct 12 '21 at 10:34
  • 1
    Debug console on Safari mobile: https://www.browserstack.com/guide/how-to-debug-on-iphone . I did not try the method though. – T.Trassoudaine Oct 12 '21 at 10:41
  • 1
    thank you for trying to help me. I just figured out that the problem is solved by removing the header application json. – Marcel Dz Oct 12 '21 at 10:46

1 Answers1

0

You can update Next JS version, for me v11.1.0 worked.

Raj
  • 1,099
  • 2
  • 13
  • 30