diff options
| author | Edijs <iamedijs@hotmail.com> | 2019-02-06 19:19:43 -0700 |
|---|---|---|
| committer | Edijs <iamedijs@hotmail.com> | 2019-02-06 19:19:43 -0700 |
| commit | 19870c0b6d4f7cb73e36b16d3c09d2011e6367a9 (patch) | |
| tree | 3cd7389b8c3d2e21367d113be9a5eb23a53e4147 /src/modules/api.js | |
| parent | fafe258f2b94cc2faf516ea2722c01e17ab8e2d8 (diff) | |
Fix issue while fetching timelines for tag page
Diffstat (limited to 'src/modules/api.js')
| -rw-r--r-- | src/modules/api.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/modules/api.js b/src/modules/api.js index 7bda13e7..95782e38 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -1,5 +1,5 @@ import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js' -import {isArray} from 'lodash' +import { isArray } from 'lodash' import { Socket } from 'phoenix' const api = { @@ -34,18 +34,24 @@ const api = { } }, actions: { - startFetching (store, timeline) { + startFetching (store, payload) { let userId = false + let timeline = 'friends' + let tag = false - // This is for user timelines - if (isArray(timeline)) { - userId = timeline[1] - timeline = timeline[0] + if (isArray(payload)) { + // For user timelines + timeline = payload[0] + userId = payload[1] + } else if (payload.tag) { + // For tag timelines + timeline = 'tag' + tag = payload.tag } // Don't start fetching if we already are. if (!store.state.fetchers[timeline]) { - const fetcher = store.state.backendInteractor.startFetching({timeline, store, userId}) + const fetcher = store.state.backendInteractor.startFetching({timeline, store, userId, tag}) store.commit('addFetcher', {timeline, fetcher}) } }, |
