4 ms·
> Can you explain why I'm stupid and everything I've done is wrong? Haha I cannot, because you probably aren't stupid and haven't done everything wrong. The t
by aarondf 9y ago
> Can you explain why I'm stupid and everything I've done is wrong?
Haha I cannot, because you probably aren't stupid and haven't done everything wrong.
The thing I like about this approach is that it removes the need for manually:
1) writing `saveCustomer` or `getCustomer` methods on my vue instance
2) tracking validation errors for each model. So if there's a collection of models on the page, I can super easily show errors for each
3) keeping track of loading indicators
4) applying the server's response to the model.
In your setup, what happens if the HTTP call fails? You have to do something with that error right? What happens if you want to show a spinning indicator that the call is working. If the server returns a response (on say a fetch or an index), what do you do with that response?
I think this (https://github.com/aarondfrancis/vue-model#update-a-model https://github.com/aarondfrancis/vue-model#update-a-model) is a good example to try to work out with the centralized service approach, and see which you like better.
Try it for one model, and then think about if you had to do two or three similar resources.
Hope that makes sense!
- Zenbit_UX 9y agoHmm interesting ideas. To answer your questions, if http call fails I'm currently handling it in a .Catch. I haven't done much specific error handling yet, was probably going to do a bunch of if statements to figure out the nature of the error and then output relevant messages to toast. For the loading indicator(s) I was planning on using just one, globally, like YouTube does - their slim red line that runs a long the top of the viewport? I'll definitely look more into your library but I'm hesitant to bulk up my app unless something provides critical functionality. Using Quasar framework right now and already a little conserned with load times and bulk. Although I haven't built for production yet with full minification, etc. Thanks for your time in responding to my stupid questions!