jasonmlutz / winner

Full stack survey app
0 stars 0 forks source link

`fetch` wrapper #11

Open jasonmlutz opened 2 years ago

jasonmlutz commented 2 years ago

There is a great deal of similarity between fetch api calls; this could be DRY'd by defining a single uniform fetch action to be used app-wide.

App-wide may be over ambitious, but at this time the survey creation and management pipeline would benefit from a single uniform fetch wrapper.

jasonmlutz commented 2 years ago

Note also that !{} is false, so any fetch call which expects this statement to trigger error handling will fail silently; for example App.jsx uses this mechanism.

The catch is that without having the controller return something, there will be an error of the for VM6735:1 Uncaught (in promise) SyntaxError: Unexpected end of JSON input at fetchCurrentUser

jasonmlutz commented 2 years ago

Related: Re-factor SurveyDisplay (creation) to push only once at the end (like NewResponse does).