2022-09-13 13:51:00 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h2>Social</h2>
|
2023-04-06 14:30:56 +00:00
|
|
|
<transition-group name="list" tag="ul">
|
2022-10-27 13:07:12 +00:00
|
|
|
<TimelineEntry v-for="entry in timeline"
|
|
|
|
:key="entry.id"
|
|
|
|
:item="entry" />
|
2022-09-13 13:51:00 +00:00
|
|
|
</transition-group>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import TimelineEntry from './../components/TimelineEntry.vue'
|
|
|
|
import axios from '@nextcloud/axios'
|
|
|
|
import { generateUrl } from '@nextcloud/router'
|
2022-10-27 13:07:12 +00:00
|
|
|
import logger from './../services/logger.js'
|
2022-09-13 13:51:00 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ProfilePageIntegration',
|
2022-10-27 13:07:12 +00:00
|
|
|
components: {
|
|
|
|
TimelineEntry,
|
|
|
|
},
|
2022-09-13 13:51:00 +00:00
|
|
|
props: {
|
|
|
|
userId: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
accountInfo: null,
|
|
|
|
timeline: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
getCount() {
|
2022-10-27 13:07:12 +00:00
|
|
|
const account = this.accountInfo
|
2022-09-13 13:51:00 +00:00
|
|
|
return (field) => account.details.count ? account.details.count[field] : ''
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// Start fetching account information before mounting the component
|
|
|
|
beforeMount() {
|
2022-10-27 13:07:12 +00:00
|
|
|
const uid = this.userId
|
2022-09-13 13:51:00 +00:00
|
|
|
|
2023-04-06 14:31:14 +00:00
|
|
|
axios.get(generateUrl(`apps/social/api/v1/global/account/info?account=${uid}`)).then(({ data }) => {
|
|
|
|
this.accountInfo = data
|
2022-10-27 13:07:12 +00:00
|
|
|
logger.log(this.accountInfo)
|
2022-09-13 13:51:00 +00:00
|
|
|
})
|
|
|
|
|
2023-04-06 14:31:14 +00:00
|
|
|
axios.get(generateUrl(`apps/social/api/v1/accounts/${uid}/statuses`)).then(({ data }) => {
|
|
|
|
this.timeline = data
|
2022-10-27 13:07:12 +00:00
|
|
|
logger.log(this.timeline)
|
2022-09-13 13:51:00 +00:00
|
|
|
})
|
2022-10-27 13:07:12 +00:00
|
|
|
},
|
2022-09-13 13:51:00 +00:00
|
|
|
}
|
|
|
|
</script>
|