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

48 lines
1.1 KiB
Vue
Raw Normal View History

2018-03-13 15:56:23 +01:00
<template>
<div id="favourites">
<div class="fav" v-for="message in favourites" v-bind:key="message.id">
<toot :message="message" v-on:update="updateToot"></toot>
2018-03-13 15:56:23 +01:00
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
import Toot from './Cards/Toot'
export default {
name: 'favourites',
components: { Toot },
computed: {
...mapState({
account: state => state.TimelineSpace.account,
favourites: state => state.TimelineSpace.Favourites.favourites
})
},
created () {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('TimelineSpace/Favourites/fetchFavourites', this.account)
.then(() => {
loading.close()
})
.catch(() => {
loading.close()
this.$message({
message: 'Could not fetch favourites',
type: 'error'
})
})
},
methods: {
updateToot (message) {
this.$store.commit('TimelineSpace/Favourites/updateToot', message)
}
2018-03-13 15:56:23 +01:00
}
}
</script>