Start fetching user timelines.

This commit is contained in:
Roger Braun 2017-06-12 16:00:46 +02:00
parent 85cf036acd
commit 090148ef60
7 changed files with 55 additions and 16 deletions

View file

@ -1,4 +1,5 @@
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
import {isArray} from 'lodash'
const api = {
state: {
@ -18,9 +19,17 @@ const api = {
},
actions: {
startFetching (store, timeline) {
let userId = false
// This is for user timelines
if (isArray(timeline)) {
userId = timeline[1]
timeline = timeline[0]
}
// Don't start fetching if we already are.
if (!store.state.fetchers[timeline]) {
const fetcher = store.state.backendInteractor.startFetching({timeline, store})
const fetcher = store.state.backendInteractor.startFetching({timeline, store, userId})
store.commit('addFetcher', {timeline, fetcher})
}
},

View file

@ -32,6 +32,17 @@ export const defaultState = {
minVisibleId: 0,
loading: false
},
user: {
statuses: [],
statusesObject: {},
faves: [],
visibleStatuses: [],
visibleStatusesObject: {},
newStatusCount: 0,
maxId: 0,
minVisibleId: 0,
loading: false
},
publicAndExternal: {
statuses: [],
statusesObject: {},