Add basic "home" screen with room list

This commit is contained in:
N-Pex 2021-02-09 12:37:56 +01:00
parent c489d58a69
commit 9c9619fe1c
5 changed files with 24 additions and 9 deletions

View file

@ -1,11 +1,26 @@
<template>
<div>
HOME
<RoomList />
<v-btn block class="outlined-button" @click.stop="logout">Logout</v-btn>
</div>
</template>
<script>
import RoomList from '../components/RoomList';
export default {
components: {
RoomList
},
methods: {
logout() {
//TODO - For guest accounts, show warning about not being able to rejoin.
this.$store.dispatch("auth/logout");
this.$nextTick(() => {
this.$navigation.push({path: "/login"}, -1);
})
},
}
};
</script>

View file

@ -64,7 +64,7 @@ export default {
this.$matrix.leaveRoom(roomId)
.then(() => {
console.log("Left room");
this.$navigation.push({name:'Chat', params:{roomId:null}}, -1);
this.$navigation.push({name:'Home', params:{roomId:null}}, -1);
})
.catch(err => {
console.log("Error leaving", err);

View file

@ -121,7 +121,11 @@ export default {
this.loading = true;
this.$store.dispatch("auth/login", user).then(
() => {
this.$navigation.push({name: "Chat", params: { roomId: util.sanitizeRoomId(this.$matrix.currentRoomId) }}, -1);
if (this.$matrix.currentRoomId) {
this.$navigation.push({name: "Chat", params: { roomId: util.sanitizeRoomId(this.$matrix.currentRoomId) }}, -1);
} else {
this.$navigation.push({name: "Home"}, -1);
}
},
(error) => {
this.loading = false;

View file

@ -291,10 +291,6 @@ export default {
this.$navigation.push({ name: "Profile" }, 1);
},
leaveRoom() {
console.log("Leave");
},
upgradeAccount() {
this.$matrix
.upgradeGuestAccount()

View file

@ -1,6 +1,6 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
//import Home from '../components/Home.vue'
import Home from '../components/Home.vue'
import Chat from '../components/Chat.vue'
import Join from '../components/Join.vue'
import Login from '../components/Login.vue'
@ -13,7 +13,7 @@ const routes = [
{
path: '/',
name: 'Home',
component: Chat
component: Home
},
{
path: '/room/:roomId?',