Reader small image

You're reading from  Vue.js 2.x by Example

Product typeBook
Published inDec 2017
Reading LevelBeginner
PublisherPackt
ISBN-139781788293464
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Mike Street
Mike Street
author image
Mike Street

Mike Street (aka mikestreety) is a frontend developer from Brighton, UK. Specializing in Gulp, SCSS, HTML, and Vue, he has been developing websites professionally since 2010. After making his first Vue app as an experimental side project, he's been hooked ever since. When not developing on the web, Mike likes to explore the Sussex countryside on his bike, start a new side-project without finishing the last, or heading to the cinema.
Read more about Mike Street

Right arrow

Caching the folder contents

Now that we have Vuex in our app and are utilizing it for the path, we can begin to look at storing the contents of the currently-displayed folder so that if the user returns to the same place, the API does not need to be queried to retrieve the results. We are going to do this by storing the object returned by the API the Vuex store.

When the folder gets requested, the app will check whether the data exists in the store. If it does, the API call will be omitted and the data loaded from the storage. If it doesn't exist, the API will be queried and the results saved in the Vuex store.

The first step is to separate out the data processing into its own method. This is because the files and folders are going to need to be split regardless of whether the data comes from the store or API.

Create a new method in the dropbox-viewer component titled createFolderStructure...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Vue.js 2.x by Example
Published in: Dec 2017Publisher: PacktISBN-13: 9781788293464

Author (1)

author image
Mike Street

Mike Street (aka mikestreety) is a frontend developer from Brighton, UK. Specializing in Gulp, SCSS, HTML, and Vue, he has been developing websites professionally since 2010. After making his first Vue app as an experimental side project, he's been hooked ever since. When not developing on the web, Mike likes to explore the Sussex countryside on his bike, start a new side-project without finishing the last, or heading to the cinema.
Read more about Mike Street