summaryrefslogtreecommitdiffstats
path: root/src/store
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-12-05 10:50:37 +0100
committerJulius Härtl <jus@bitgrid.net>2018-12-05 10:50:37 +0100
commitc3bd113694ef1e50f811684f8a71e9132ed10733 (patch)
treef0c29d717bf9bdb90a2c4a5044e1554866f5829d /src/store
parent9d71a7b50c710f12051dba04e05c3dc366798bd1 (diff)
Add public stream to profile page
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/timeline.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js
index cadbd990..c31fb245 100644
--- a/src/store/timeline.js
+++ b/src/store/timeline.js
@@ -26,7 +26,8 @@ import Vue from 'vue'
const state = {
timeline: {},
since: Math.floor(Date.now() / 1000) + 1,
- type: 'home'
+ type: 'home',
+ account: ''
}
const mutations = {
addToTimeline(state, data) {
@@ -41,6 +42,9 @@ const mutations = {
},
setTimelineType(state, type) {
state.type = type
+ },
+ setAccount(state, account) {
+ state.account = account
}
}
const getters = {
@@ -54,6 +58,12 @@ const actions = {
changeTimelineType(context, type) {
context.commit('resetTimeline')
context.commit('setTimelineType', type)
+ context.commit('setAccount', '')
+ },
+ changeTimelineTypeAccount(context, account) {
+ context.commit('resetTimeline')
+ context.commit('setTimelineType', 'account')
+ context.commit('setAccount', account)
},
post(context, post) {
return axios.post(OC.generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => {
@@ -64,14 +74,20 @@ const actions = {
console.error('Failed to create a post', error)
})
},
- refreshTimeline(context, account) {
- return this.dispatch('fetchTimeline', { account: account, sinceTimestamp: Math.floor(Date.now() / 1000) + 1 })
+ refreshTimeline(context) {
+ return this.dispatch('fetchTimeline', { sinceTimestamp: Math.floor(Date.now() / 1000) + 1 })
},
- fetchTimeline(context, { account, sinceTimestamp }) {
+ fetchTimeline(context, { sinceTimestamp }) {
if (typeof sinceTimestamp === 'undefined') {
sinceTimestamp = state.since - 1
}
- return axios.get(OC.generateUrl(`apps/social/api/v1/stream/${state.type}?limit=5&since=` + sinceTimestamp)).then((response) => {
+ let url
+ if (state.type === 'account') {
+ url = OC.generateUrl(`apps/social/api/v1/account/${state.account}/stream?limit=25&since=` + sinceTimestamp)
+ } else {
+ url = OC.generateUrl(`apps/social/api/v1/stream/${state.type}?limit=25&since=` + sinceTimestamp)
+ }
+ return axios.get(url).then((response) => {
if (response.status === -1) {
throw response.message
}