Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
user can delete and edit accounts
- Loading branch information
1 parent
d569fce
commit 6c3e206
Showing
8 changed files
with
96 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ npm-debug.log | |
test/unit/coverage | ||
test/e2e/reports | ||
selenium-debug.log | ||
.idea/ |
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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
export const addAccount = ({ commit }, data) => { | ||
commit('ADD_ACCOUNT', { account: data }); | ||
}; | ||
|
||
export const updateAccount = ({ commit }, data) => { | ||
commit('UPDATE_ACCOUNT', { account: data }); | ||
}; | ||
|
||
export const deleteAccount = ({ commit }, data) => { | ||
commit('DELETE_ACCOUNT', { account: data }); | ||
}; |
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,5 @@ | ||
export default { | ||
getAccountById: (state, getters) => (accountId) => { | ||
return state.accounts && accountId in state.accounts ? state.accounts[accountId] : false; | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import Vue from 'vue'; | ||
import { guid } from '../../../utils'; | ||
|
||
export default { | ||
ADD_ACCOUNT (state, payload) { | ||
let id = guid(); | ||
state.accounts[id] = Object.assign({ id: id }, payload.account); | ||
}, | ||
|
||
UPDATE_ACCOUNT (state, payload) { | ||
state.accounts[payload.account.id] = payload.account; | ||
}, | ||
|
||
DELETE_ACCOUNT (state, payload) { | ||
Vue.delete(state.accounts, payload.account.id); | ||
} | ||
}; |