25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 8.12: Saved page Implementing the saved page will require an enhancement to our app architecture,<br />

however. Let's do a quick recap of how data is retrieved from the server to underst<strong>and</strong> why.<br />

All the pages in our app require a route on the server to return a view. This view<br />

includes the data for the relevant page component inlined in the document head.<br />

Or, if we navigate to that page via in-app links, an API endpoint will instead<br />

supply that same data. We set up this mechanism in Chapter 7, Building A Multi-<br />

Page App With <strong>Vue</strong> Router.<br />

The saved page will require the same data as the home page (the listing summary<br />

data), as the saved page is really just a slight variation on the home page. It<br />

makes sense, then, to share data between the home page <strong>and</strong> saved page. In other<br />

words, if a user loads <strong>Vue</strong>bnb from the home page, then navigates to the saved<br />

page, or vice versa, it would be a waste to load the listing summary data more<br />

than once.

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

Saved successfully!

Ooh no, something went wrong!