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">
|
2018-03-14 10:08:07 +01:00
|
|
|
<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'
|
|
|
|
})
|
|
|
|
})
|
2018-03-14 10:08:07 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
updateToot (message) {
|
|
|
|
this.$store.commit('TimelineSpace/Favourites/updateToot', message)
|
|
|
|
}
|
2018-03-13 15:56:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|