Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

navigate throws error with error log showing "wth" #109

Open
grayson-solutions opened this issue Feb 27, 2020 · 2 comments · May be fixed by #164
Open

navigate throws error with error log showing "wth" #109

grayson-solutions opened this issue Feb 27, 2020 · 2 comments · May be fixed by #164

Comments

@grayson-solutions
Copy link

I have a button which on click uses axios to save the form data. I have that in a try catch. The axios request works just fine, but when I try to navigate to a new "page", an error is thrown. When I catch and log the error it just shows: wth !

const SaveEvent = async () => {
        let savedOk = false
        setSaving(true)
        const data = {
            ...
        }
        try {
          const result = await axios({
            method: 'post',
            url: 'http://localhost:49505/principal/api/AddEvent',
            headers : {'content-type' : 'application/json'},
            data: JSON.stringify(data)
          })
          if (result.data === "ok") {
                alert("Evening Saved")
                savedOk = true
                navigate('/admin/events', true);
         
          }
      } catch (e) {
        console.log(e);
        alert("Error Saving Data")            
      } finally {
        if (!savedOk) setSaving(false)
      }; 
  }

...

<button className="btn right waves-effect waves-light" id="btnAddEventSave" onClick={SaveEvent}><i className="material-icons left">save</i> SAVE</button>

...

{saving &&
    <div className="progress">
        <div className="indeterminate"></div>
    </div>
    }

if I move the navigate out of the try/catch, I get an error in the console saying uncaught error...

The navigation works ok, but I don't want to have to check for a wth error in my catch. What am I doing wrong>

@Mrbeyond
Copy link

I also observed the same in my app as well. I wish to know what is really causing that.

@howesteve
Copy link

Same here... "Uncaught wth" when navigating.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants