thelounge/client/components/RoutedChat.vue

36 lines
692 B
Vue
Raw Normal View History

2019-10-17 18:56:44 +02:00
<template>
<Chat v-if="activeChannel" :network="activeChannel.network" :channel="activeChannel.channel" />
</template>
<script>
// Temporary component for routing channels and lobbies
import Chat from "./Chat.vue";
export default {
name: "RoutedChat",
components: {
Chat,
},
computed: {
activeChannel() {
const chan_id = parseInt(this.$route.params.pathMatch);
const channel = this.$store.getters.findChannel(chan_id);
2019-10-17 18:56:44 +02:00
return channel;
},
},
watch: {
activeChannel() {
this.setActiveChannel();
},
},
mounted() {
this.setActiveChannel();
},
methods: {
setActiveChannel() {
this.$store.commit("activeChannel", this.activeChannel);
2019-10-17 18:56:44 +02:00
},
},
};
</script>