Setting up Nuxt Store
This commit is contained in:
11
store/Sidebar.js
Normal file
11
store/Sidebar.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
export const state = () => ({
|
||||||
|
cardsShown: true
|
||||||
|
})
|
||||||
|
|
||||||
|
export const mutations = {
|
||||||
|
toggleCardsShown (state) {
|
||||||
|
console.log(state.cardsShown)
|
||||||
|
if (process.browser) localStorage.setItem('cardsShown', !state.cardsShown)
|
||||||
|
state.cardsShown = !state.cardsShown
|
||||||
|
}
|
||||||
|
}
|
||||||
7
store/index.js
Normal file
7
store/index.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const state = () => ({
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
export const mutations = {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user