Move some interactions to the backendInteractor
The idea is that all interactions should move there, so components don't have to pass around credentials all the time.
This commit is contained in:
parent
b1f9f6395c
commit
215e51f764
6 changed files with 50 additions and 9 deletions
|
@ -1,6 +1,5 @@
|
|||
import { find, filter, sortBy, toInteger } from 'lodash'
|
||||
import Status from '../status/status.vue'
|
||||
import apiService from '../../services/api/api.service.js'
|
||||
|
||||
const conversation = {
|
||||
computed: {
|
||||
|
@ -32,12 +31,12 @@ const conversation = {
|
|||
fetchConversation () {
|
||||
if (this.status) {
|
||||
const conversationId = this.status.statusnet_conversation_id
|
||||
apiService.fetchConversation({id: conversationId})
|
||||
this.$store.state.api.backendInteractor.fetchConversation({id: conversationId})
|
||||
.then((statuses) => this.$store.dispatch('addNewStatuses', { statuses }))
|
||||
.then(() => this.$store.commit('updateTimestamps'))
|
||||
} else {
|
||||
const id = this.$route.params.id
|
||||
apiService.fetchStatus({id})
|
||||
this.$store.state.api.backendInteractor.fetchStatus({id})
|
||||
.then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] }))
|
||||
.then(() => this.fetchConversation())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue