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>
|
2018-03-22 10:09:58 +01:00
|
|
|
<div class="page">
|
|
|
|
<div class="header">
|
|
|
|
<header-menu></header-menu>
|
|
|
|
</div>
|
|
|
|
<div class="content">
|
|
|
|
<router-view></router-view>
|
|
|
|
</div>
|
2018-03-09 07:21:25 +01:00
|
|
|
</div>
|
2018-03-12 17:42:47 +01:00
|
|
|
<new-toot-modal></new-toot-modal>
|
2018-03-21 07:24:07 +01:00
|
|
|
<jump-modal></jump-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-22 10:09:58 +01:00
|
|
|
import HeaderMenu from './TimelineSpace/HeaderMenu'
|
2018-03-12 17:42:47 +01:00
|
|
|
import NewTootModal from './TimelineSpace/NewTootModal'
|
2018-03-21 07:24:07 +01:00
|
|
|
import JumpModal from './TimelineSpace/JumpModal'
|
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-22 10:09:58 +01:00
|
|
|
components: { SideMenu, HeaderMenu, NewTootModal, JumpModal },
|
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-21 02:41:53 +01:00
|
|
|
this.initialize()
|
|
|
|
.then(() => {
|
|
|
|
loading.close()
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
loading.close()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
|
|
|
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async clear () {
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearAccount')
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearUsername')
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearTimeline')
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearNotifications')
|
|
|
|
await this.$store.dispatch('TimelineSpace/removeShortcutEvents')
|
|
|
|
return 'clear'
|
|
|
|
},
|
|
|
|
async initialize () {
|
|
|
|
await this.clear()
|
|
|
|
|
|
|
|
this.$store.dispatch('TimelineSpace/watchShortcutEvents')
|
|
|
|
try {
|
|
|
|
const account = await this.$store.dispatch('TimelineSpace/fetchAccount', this.$route.params.id)
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('TimelineSpace/fetchHomeTimeline', account)
|
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch timeline',
|
|
|
|
type: 'error'
|
2018-03-13 11:18:02 +01:00
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('TimelineSpace/username', account)
|
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch username',
|
|
|
|
type: 'error'
|
2018-03-13 14:35:04 +01:00
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('TimelineSpace/fetchNotifications', account)
|
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch notification',
|
|
|
|
type: 'error'
|
2018-03-13 11:18:02 +01:00
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
2018-03-14 04:24:54 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
2018-03-21 02:41:53 +01:00
|
|
|
} catch (err) {
|
2018-03-11 17:20:08 +01:00
|
|
|
this.$message({
|
|
|
|
message: 'Could not find account',
|
|
|
|
type: 'error'
|
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
|
|
|
}
|
2018-03-08 16:24:18 +01:00
|
|
|
}
|
2018-03-08 10:36:09 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2018-03-22 10:09:58 +01:00
|
|
|
.page {
|
2018-03-09 09:36:57 +01:00
|
|
|
margin-left: 180px;
|
2018-03-22 10:09:58 +01:00
|
|
|
|
|
|
|
.header {
|
|
|
|
width: 100%;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 245px;
|
|
|
|
height: 48px;
|
|
|
|
background-color: #ffffff;
|
|
|
|
border-bottom: solid 1px #dcdfe6;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
2018-03-22 10:33:31 +01:00
|
|
|
margin-top: 48px;
|
2018-03-22 10:09:58 +01:00
|
|
|
}
|
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>
|