From 69cb891b1a1d58a81b183452164d9ec08a49342b Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 26 Feb 2019 22:23:41 +0200 Subject: [PATCH] Add vuex and move isConnected to vuex state. --- client/components/ChatInput.vue | 6 +++--- client/components/MessageList.vue | 4 ++-- client/js/socket-events/auth.js | 4 ++-- client/js/socket-events/init.js | 2 +- client/js/socket.js | 2 +- client/js/store.js | 15 +++++++++++++++ client/js/upload.js | 6 ++---- client/js/vue.js | 3 ++- package.json | 1 + yarn.lock | 5 +++++ 10 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 client/js/store.js diff --git a/client/components/ChatInput.vue b/client/components/ChatInput.vue index d10f0305..609707f7 100644 --- a/client/components/ChatInput.vue +++ b/client/components/ChatInput.vue @@ -30,7 +30,7 @@ id="upload" type="button" aria-label="Upload file" - :disabled="!this.$root.isConnected" + :disabled="!$store.state.isConnected" /> @@ -187,7 +187,7 @@ export default { this.$refs.input.click(); this.$refs.input.focus(); - if (!this.$root.isConnected) { + if (!$store.state.isConnected) { return false; } diff --git a/client/components/MessageList.vue b/client/components/MessageList.vue index 710485bc..237de9be 100644 --- a/client/components/MessageList.vue +++ b/client/components/MessageList.vue @@ -3,7 +3,7 @@