25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

to.path !== serverData.path) { axios.get(`/api${to.path}`).then(({data}) => {<br />

store.commit('addData', {route: to.name, data}); next(); }); } else {<br />

store.commit('addData', {route: to.name, data: serverData}); next(); } });<br />

With that done, if the in-app navigation is used to navigate from the home page<br />

to listing 1, then back to the home page, then back to listing 1, the app will<br />

retrieve listing 1 from the API just the once. It would have done it twice under<br />

the previous architecture!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!