2018-03-08 10:36:09 +01:00
|
|
|
<template>
|
|
|
|
<div id="timeline_space">
|
2018-03-09 07:21:25 +01:00
|
|
|
<side-menu></side-menu>
|
|
|
|
<div class="content">
|
|
|
|
<router-view></router-view>
|
|
|
|
</div>
|
2018-03-12 17:42:47 +01:00
|
|
|
<new-toot-modal></new-toot-modal>
|
2018-03-08 10:36:09 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-03-09 07:21:25 +01:00
|
|
|
import SideMenu from './TimelineSpace/SideMenu'
|
2018-03-12 17:42:47 +01:00
|
|
|
import NewTootModal from './TimelineSpace/NewTootModal'
|
2018-03-09 07:21:25 +01:00
|
|
|
|
2018-03-08 10:36:09 +01:00
|
|
|
export default {
|
2018-03-08 16:24:18 +01:00
|
|
|
name: 'timeline-space',
|
2018-03-12 17:42:47 +01:00
|
|
|
components: { SideMenu, NewTootModal },
|
2018-03-08 16:24:18 +01:00
|
|
|
created () {
|
2018-03-13 15:31:06 +01:00
|
|
|
const loading = this.$loading({
|
|
|
|
lock: true,
|
|
|
|
text: 'Loading',
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
})
|
2018-03-14 06:57:51 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/watchShortcutEvents')
|
2018-03-11 17:20:08 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/fetchAccount', this.$route.params.id)
|
|
|
|
.then((account) => {
|
2018-03-12 09:17:41 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/fetchHomeTimeline', account)
|
2018-03-13 15:31:06 +01:00
|
|
|
.then(() => {
|
|
|
|
loading.close()
|
|
|
|
})
|
2018-03-13 11:18:02 +01:00
|
|
|
.catch(() => {
|
2018-03-13 15:31:06 +01:00
|
|
|
loading.close()
|
2018-03-13 11:18:02 +01:00
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch timeline',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-03-14 04:24:54 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/username', account)
|
2018-03-13 14:35:04 +01:00
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
2018-03-14 04:24:54 +01:00
|
|
|
message: 'Could not fetch username',
|
2018-03-13 14:35:04 +01:00
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-03-14 04:24:54 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/fetchNotifications', account)
|
2018-03-13 11:18:02 +01:00
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
2018-03-14 04:24:54 +01:00
|
|
|
message: 'Could not fetch notification',
|
2018-03-13 11:18:02 +01:00
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-03-14 04:24:54 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
2018-03-13 11:18:02 +01:00
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
2018-03-14 04:24:54 +01:00
|
|
|
message: 'Could not start user streaming',
|
2018-03-13 11:18:02 +01:00
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-03-11 17:20:08 +01:00
|
|
|
})
|
|
|
|
.catch(() => {
|
2018-03-13 15:31:06 +01:00
|
|
|
loading.close()
|
2018-03-11 17:20:08 +01:00
|
|
|
this.$message({
|
|
|
|
message: 'Could not find account',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-03-12 08:47:27 +01:00
|
|
|
},
|
|
|
|
beforeDestroy () {
|
2018-03-20 14:12:06 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/clearAccount')
|
|
|
|
this.$store.dispatch('TimelineSpace/clearUsername')
|
|
|
|
this.$store.commit('TimelineSpace/clearTimeline')
|
|
|
|
this.$store.commit('TimelineSpace/clearNotifications')
|
2018-03-12 08:47:27 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
2018-03-14 06:57:51 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/removeShortcutEvents')
|
2018-03-08 16:24:18 +01:00
|
|
|
}
|
2018-03-08 10:36:09 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2018-03-09 07:21:25 +01:00
|
|
|
.content {
|
2018-03-09 09:36:57 +01:00
|
|
|
margin-left: 180px;
|
2018-03-09 07:21:25 +01:00
|
|
|
}
|
2018-03-12 17:42:47 +01:00
|
|
|
|
2018-03-08 10:36:09 +01:00
|
|
|
</style>
|