refactor: don't make API calls directly
This commit is contained in:
parent
9217ca8476
commit
a6136f6cb2
8 changed files with 115 additions and 47 deletions
|
@ -41,8 +41,7 @@ const ListNew = {
|
|||
}
|
||||
},
|
||||
...mapState({
|
||||
currentUser: state => state.users.currentUser,
|
||||
backendInteractor: state => state.api.backendInteractor
|
||||
currentUser: state => state.users.currentUser
|
||||
}),
|
||||
...mapGetters(['findUser'])
|
||||
},
|
||||
|
@ -86,12 +85,10 @@ const ListNew = {
|
|||
createList () {
|
||||
// the API has two different endpoints for "creating a list with a name"
|
||||
// and "updating the accounts on the list".
|
||||
this.$store.state.api.backendInteractor.createList({ title: this.title })
|
||||
.then((data) => {
|
||||
this.$store.state.api.backendInteractor.addAccountsToList({
|
||||
id: data.id, accountIds: this.selectedUserIds
|
||||
})
|
||||
this.$router.push({ name: 'list-timeline', params: { id: data.id } })
|
||||
this.$store.dispatch('createList', { title: this.title })
|
||||
.then((list) => {
|
||||
this.$store.dispatch('setListAccounts', { id: list.id, accountIds: this.selectedUserIds })
|
||||
this.$router.push({ name: 'list-timeline', params: { id: list.id } })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue