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
const state => () => ({ | |
cats: { | |
loaded: false, | |
data: [] | |
} | |
}) | |
const mutations = { | |
SET_CATS (state, payload) { | |
// merge payload with state |
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
import { isFunction } from './helpers' | |
const GET_KEY = 'get' | |
const PUSH_KEY = 'PUSH_TO_' | |
const SET_KEY = 'SET_' | |
function mergeWithViewState (state, payload) { | |
Object.keys(payload).forEach(key => { | |
state[key] = payload[key] | |
}) |