Skip to content

Commit

Permalink
Use mapActions to load current channel
Browse files Browse the repository at this point in the history
  • Loading branch information
LianaHarris360 committed Sep 17, 2024
1 parent fac36cf commit b83e0c6
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,19 @@
},
watch: {
rootId: {
handler: 'reloadChannel',
handler(id) {
if (!id) {
this.loadChannel().catch(() => {
this.$store.dispatch('showSnackbarSimple', 'Failed to load channel');
});
}
},
immediate: true,
},
},
methods: {
...mapActions('channel', ['deleteChannel']),
...mapActions('currentChannel', ['loadChannel']),
handleDelete() {
this.deleteChannel(this.currentChannel.id).then(() => {
localStorage.snackbar = this.$tr('channelDeletedSnackbar');
Expand All @@ -497,13 +504,6 @@
trackClickEvent(eventLabel) {
this.$analytics.trackClick('channel_editor_toolbar', eventLabel);
},
reloadChannel(id) {
if (!id) {
this.$store.dispatch('currentChannel/loadChannel').catch(error => {
throw new Error(error);
});
}
},
},
$trs: {
channelDetails: 'View channel details',
Expand Down

0 comments on commit b83e0c6

Please sign in to comment.