hardlounge/client/components/RoutedChat.vue

41 lines
728 B
Vue
Raw Normal View History

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