Verified Commit 1eda1348 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fixed some mutations issues

parent 7d1cb367
Pipeline #4227 passed with stages
in 1 minute and 29 seconds
......@@ -17,12 +17,13 @@ export const storeConfig = {
cache: {}
},
mutations: {
addAccount ({state}, payload) {
addAccount (state, payload) {
const id = sources.sources[payload.source].authDataToKey(payload)
payload.id = id
state.accounts[id] = payload
},
setRecursiveState ({state}, {key, suffix, value}) {
setRecursiveState (state, {key, suffix, value}) {
console.log('SETTING RECURSIVE', key, suffix, value, state)
if (suffix) {
let existing = get(state, key, {})
existing[suffix] = value
......
......@@ -14,7 +14,7 @@ describe('mutations', () => {
"mastodon test.domain user": payload
}
}
store.mutations.addAccount({state}, payload)
store.mutations.addAccount(state, payload)
expect(state).to.deep.equal(expected)
})
it('setRecursiveState', () => {
......@@ -28,7 +28,7 @@ describe('mutations', () => {
world: "test.domain"
}
}
store.mutations.setRecursiveState({state}, payload)
store.mutations.setRecursiveState(state, payload)
expect(state).to.deep.equal(expected)
})
it('setRecursiveState with suffix', () => {
......@@ -45,7 +45,7 @@ describe('mutations', () => {
}
}
}
store.mutations.setRecursiveState({state}, payload)
store.mutations.setRecursiveState(state, payload)
expect(state).to.deep.equal(expected)
})
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment