summaryrefslogtreecommitdiffstats
path: root/src/store
diff options
context:
space:
mode:
authorCyrille Bollu <cyrpub@bollu.be>2019-09-15 12:51:13 +0200
committerMaxence Lange <maxence@artificial-owl.com>2019-09-25 14:11:10 +0200
commit15b733675173d10d0dae980669f894fa80d217f5 (patch)
treede2ed60e1a5afb9b269c9e4bbaa3bd6b3718102b /src/store
parent445b52b049e00c201f20656586d159082fd6c99c (diff)
New, working, TimelineSinglePost view
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/timeline.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js
index 74c71de8..a89b85b2 100644
--- a/src/store/timeline.js
+++ b/src/store/timeline.js
@@ -21,6 +21,7 @@
*
*/
+import Logger from '../logger'
import axios from 'nextcloud-axios'
import Vue from 'vue'
@@ -92,6 +93,15 @@ const getters = {
return Object.values(state.timeline).sort(function(a, b) {
return b.publishedTime - a.publishedTime
})
+ },
+ getPostFromTimeline(state) {
+ return (postId) => {
+ if (typeof state.timeline[postId] !== 'undefined') {
+ return state.timeline[postId]
+ } else {
+ Logger.warn('Could not find post in timeline', { postId: postId })
+ }
+ }
}
}
const actions = {
@@ -187,18 +197,18 @@ const actions = {
}
// Compute URl to get the data
- let url
+ let url = ''
if (state.type === 'account') {
url = OC.generateUrl(`apps/social/api/v1/account/${state.account}/stream?limit=25&since=` + sinceTimestamp)
} else if (state.type === 'tags') {
url = OC.generateUrl(`apps/social/api/v1/stream/tag/${state.params.tag}?limit=25&since=` + sinceTimestamp)
} else if (state.type === 'single-post') {
- url = OC.generateUrl(`apps/social/local/v1/post?id=${state.params.id}`)
+ url = OC.generateUrl(`apps/social/local/v1/post/replies?id=${state.params.id}&limit=5&since=` + sinceTimestamp)
} else {
url = OC.generateUrl(`apps/social/api/v1/stream/${state.type}?limit=25&since=` + sinceTimestamp)
}
- // Get the data
+ // Get the data and add them to the timeline
return axios.get(url).then((response) => {
if (response.status === -1) {