Whalebird-desktop-client-ma.../src/renderer/components/TimelineSpace/Contents/Lists.vue

56 lines
1.1 KiB
Vue
Raw Normal View History

<template>
<div id="lists">
2018-04-09 14:10:25 +02:00
<div class="list-timeline" v-for="message in timeline" v-bind:key="message.id">
<toot :message="message"></toot>
</div>
</div>
</template>
<script>
2018-04-09 14:10:25 +02:00
import { mapState } from 'vuex'
import Toot from './Cards/Toot'
export default {
2018-04-09 14:10:25 +02:00
name: 'lists',
props: ['list_id'],
components: { Toot },
computed: {
...mapState({
timeline: state => state.TimelineSpace.Contents.Lists.timeline
})
},
created () {
this.load()
},
watch: {
list_id: function () {
this.load()
}
},
methods: {
load () {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('TimelineSpace/Contents/Lists/fetchTimeline', this.list_id)
.then(() => {
loading.close()
})
.catch(() => {
loading.close()
this.$message({
message: 'Failed to get timeline',
type: 'error'
})
})
}
}
}
</script>
<style lang="scss" scoped>
</style>