pleroma-fe/src/components/user_profile/user_profile.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-11-30 23:32:22 +01:00
import UserCardContent from '../user_card_content/user_card_content.vue'
2017-06-04 15:22:41 +02:00
import Timeline from '../timeline/timeline.vue'
import timelineFetcher from '../../services/timeline_fetcher/timeline_fetcher.service.js'
2016-11-30 23:32:22 +01:00
const UserProfile = {
2017-06-04 15:22:41 +02:00
data: () => ({timeline: { visibleStatuses: [] }}),
created () {
this.$store.state.api.backendInteractor.getUser(this.userId)
.then((user) => {
if (!user.error) {
this.$store.commit('addNewUsers', [user])
}
})
const store = this.$store
const credentials = store.state.users.currentUser.credentials
const timelineData = this.timeline
timelineFetcher.fetchStatuses({
timelineData,
credentials,
timeline: 'user',
userId: this.userId
}).then((data) => {
this.timeline.visibleStatuses = data
})
},
2016-11-30 23:32:22 +01:00
computed: {
2017-06-04 15:22:41 +02:00
userId () {
return parseInt(this.$route.params.id)
},
2016-11-30 23:32:22 +01:00
user () {
2017-06-04 15:22:41 +02:00
return this.$store.state.users.usersObject[this.userId]
2016-11-30 23:32:22 +01:00
}
},
components: {
2017-06-04 15:22:41 +02:00
UserCardContent,
Timeline
2016-11-30 23:32:22 +01:00
}
}
export default UserProfile