mattstauffer / suggestive

Suggestive - take suggestions from the fans/followers of your podcast or blog
MIT License
98 stars 26 forks source link

Move getting UnflaggedTopics to Route Data Loader #10

Open weblee opened 8 years ago

weblee commented 8 years ago

Hey Matt,

Not sure if you have seen this yet but the Router has a nice set of methods you can use to load data and display loading text/images. It does it through a promise so the page will load and the data will load asynchronous. See more here: http://vuejs.github.io/vue-router/en/pipeline/hooks.html

Will give the user a better experience if the http response is slow or allot of data :-)

weblee commented 8 years ago

Sorry Matt,

Forgot to say you will need to pull in Promise and add to your app.js file ie.

window.Promise = require('promise');
weblee commented 8 years ago

Worth a read Matt: http://vuejs.github.io/vue-router/en/pipeline/data.html You will see the benefits of loading via the router hooks. What got me into this was Vue started to complain it was trying to load data on the page which was not present yet. Hence I had to add a promise.. Maybe because it was a larger data set :-)

mattstauffer commented 8 years ago

@weblee FYI, hoping to come back to this soon--I'm excited to learn about it, and appreciate you sharing!