refs #62 Update favourited status in local

This commit is contained in:
AkiraFukushima 2018-03-14 18:11:38 +09:00
parent b4ffccf27c
commit 77f5749311
2 changed files with 15 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<template>
<div id="local">
<div class="local-timeline" v-for="message in timeline" v-bind:key="message.id">
<toot :message="message"></toot>
<toot :message="message" v-on:update="updateToot"></toot>
</div>
</div>
</template>
@ -24,6 +24,11 @@ export default {
},
beforeDestroy () {
this.$store.dispatch('TimelineSpace/Local/stopLocalStreaming')
},
methods: {
updateToot (message) {
this.$store.commit('TimelineSpace/Local/updateToot', message)
}
}
}
</script>

View File

@ -8,6 +8,15 @@ const Local = {
mutations: {
appendTimeline (state, update) {
state.timeline = [update].concat(state.timeline)
},
updateToot (state, message) {
state.timeline = state.timeline.map((toot) => {
if (toot.id === message.id) {
return message
} else {
return toot
}
})
}
},
actions: {