INNER CODE UNIT · JavaScript
state
VueTubeApp/VueTube · NUXT/store/playlist/index.js:1
export const state = () => ({
playlists: [],
currentPlaylist: null,
});
// Shape of playlists
// [playlist, playlist]
// Shape of playlist
// {name: string, videos: []}
// Shape of currentPlaylist
// {index: number, name: string, videos: []}
export const mutations = {
initPlaylists(state) {
if (process.client) {
// read local storage and parse the list of objects