-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
119 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// An action will receive the store as the first argument. | ||
// Since we are only interested in the dispatch (and optionally the state) | ||
// we can pull those two parameters using the ES6 destructuring feature | ||
export const toggleSiteNavVisible = function ({dispatch, state}) { | ||
dispatch('TOGGLE_SITENAV_VISIBLE') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This getter is a function which just returns the count | ||
// With ES6 you can also write it as: | ||
// export const getCount = state => state.count | ||
|
||
export function getSiteNavVisible (state) { | ||
return state.siteNavVisible | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Vue from 'vue' | ||
import Vuex from 'vuex' | ||
|
||
Vue.use(Vuex) | ||
|
||
// Create an object to hold the initial state when | ||
// the app starts up | ||
const state = { | ||
siteNavVisible: false | ||
} | ||
|
||
// Create an object storing various mutations. We will write the mutation | ||
const mutations = { | ||
// TODO: set up our mutations | ||
TOGGLE_SITENAV_VISIBLE: function (state, amount) { | ||
if (amount === undefined) { | ||
state.siteNavVisible = !state.siteNavVisible | ||
} | ||
else { | ||
state.siteNavVisible = amount | ||
} | ||
} | ||
} | ||
|
||
// Combine the initial state and the mutations to create a Vuex store. | ||
// This store can be linked to our app. | ||
export default new Vuex.Store({ | ||
state, | ||
mutations | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters