From 1f7ad31865ef7707c842cfde5e9203a18d833e11 Mon Sep 17 00:00:00 2001 From: Travis Shivers Date: Wed, 26 Aug 2020 21:16:03 -0500 Subject: [PATCH] feat(logo): add link to logo that goes to root --- src/App.vue | 26 ++++++++++++++----------- src/store/modules/synclounge/actions.js | 7 +++++-- src/views/createroom.vue | 3 +++ src/views/join.vue | 5 +++++ 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/App.vue b/src/App.vue index 784117b3..272e8399 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,17 +11,21 @@ > - - - - + + + + + + { - // TODO: make wrapper method that disconnects the socket if it already exists + DISCONNECT_IF_CONNECTED: async ({ dispatch }) => { if (isConnected()) { await dispatch('DISCONNECT'); } + }, + + ESTABLISH_SOCKET_CONNECTION: async ({ getters, commit, dispatch }) => { + await dispatch('DISCONNECT_IF_CONNECTED'); const properBase = new URL(getters.GET_SERVER, window.location); const url = combineUrl('socket.io', properBase.toString()); diff --git a/src/views/createroom.vue b/src/views/createroom.vue index 2fa0c470..def4d994 100644 --- a/src/views/createroom.vue +++ b/src/views/createroom.vue @@ -90,6 +90,8 @@ export default { }, async created() { + await this.DISCONNECT_IF_CONNECTED(); + if (this.GET_CONFIG.autojoin) { this.$router.push({ name: 'join', @@ -104,6 +106,7 @@ export default { ...mapActions('synclounge', [ 'FETCH_SERVERS_HEALTH', 'CREATE_AND_JOIN_ROOM', + 'DISCONNECT_IF_CONNECTED', ]), async fetchServersHealth() { diff --git a/src/views/join.vue b/src/views/join.vue index 2789ba63..022d6ea7 100644 --- a/src/views/join.vue +++ b/src/views/join.vue @@ -97,9 +97,14 @@ export default { ]), }, + async created() { + await this.DISCONNECT_IF_CONNECTED(); + }, + methods: { ...mapActions('synclounge', [ 'SET_AND_CONNECT_AND_JOIN_ROOM', + 'DISCONNECT_IF_CONNECTED', ]), async joinInvite() {