refs #62 Update favourited status in local
This commit is contained in:
parent
b4ffccf27c
commit
77f5749311
|
@ -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>
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in New Issue