thelounge/client/components/RoutedChat.vue

43 lines
753 B
Vue
Raw Permalink Normal View History

2019-10-17 18:56:44 +02:00
<template>
<Chat
v-if="activeChannel"
:network="activeChannel.network"
:channel="activeChannel.channel"
:focused="this.$route.query.focused"
/>
2019-10-17 18:56:44 +02:00
</template>
<script>
// Temporary component for routing channels and lobbies
import Chat from "./Chat.vue";
export default {
name: "RoutedChat",
components: {
Chat,
},
computed: {
activeChannel() {
2021-06-29 05:41:16 +02:00
const channel = this.$store.getters.findChannelByName(
this.$route.params.networkHost,
this.$route.params.channelName
);
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>