Created
January 18, 2017 16:51
-
-
Save TheDutchCoder/ba27e46c996a1509b5c88fbb1f1e9201 to your computer and use it in GitHub Desktop.
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
// Types. | |
import { | |
NOTIFICATIONS_ADD, | |
NOTIFICATIONS_REMOVE | |
} from '../mutation-types' | |
// Default state. | |
const state = { | |
items: [] | |
} | |
// Mutations. | |
const mutations = { | |
[NOTIFICATIONS_ADD] (state, notification) { | |
state.items.push(notification) | |
}, | |
[NOTIFICATIONS_REMOVE] (state, index) { | |
state.items = [ | |
...state.items.slice(0, index), | |
...state.items.slice(index + 1) | |
] | |
} | |
} | |
// Export. | |
export default { | |
state, | |
mutations | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment