diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2022-06-05 12:31:30 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2022-06-05 12:31:30 +0200 |
commit | bc78028cd869f067ce3c8a8af4bf0a6399ac5067 (patch) | |
tree | d027f002b158e76b7aa0eeac5ef288b3be5f0a19 | |
parent | f1a1f890a6628b4ce11707b18c570d90e82bd21a (diff) | |
download | lom_frontend-bc78028cd869f067ce3c8a8af4bf0a6399ac5067.tar.gz lom_frontend-bc78028cd869f067ce3c8a8af4bf0a6399ac5067.zip |
Repair bug - multiple socket connections
-rw-r--r-- | src/services/CommandsService.js | 3 | ||||
-rw-r--r-- | src/views/Home.vue | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/services/CommandsService.js b/src/services/CommandsService.js index 18ef243..2f6235e 100644 --- a/src/services/CommandsService.js +++ b/src/services/CommandsService.js | |||
@@ -39,7 +39,8 @@ export default { | |||
39 | window.open('https://github.com/jdlugosz963/lom_frontend/blob/master/README.md', '_blank'); | 39 | window.open('https://github.com/jdlugosz963/lom_frontend/blob/master/README.md', '_blank'); |
40 | }, | 40 | }, |
41 | 41 | ||
42 | logout() { | 42 | logout(searcher) { |
43 | searcher.$emit('dissconect_socket') | ||
43 | AuthService.logout() | 44 | AuthService.logout() |
44 | store.dispatch('logout') | 45 | store.dispatch('logout') |
45 | router.push('/login') | 46 | router.push('/login') |
diff --git a/src/views/Home.vue b/src/views/Home.vue index 205a260..5885c7b 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue | |||
@@ -25,6 +25,7 @@ | |||
25 | <Searcher | 25 | <Searcher |
26 | v-if="popups.searcher_show" | 26 | v-if="popups.searcher_show" |
27 | @close="hideSearcher" | 27 | @close="hideSearcher" |
28 | @dissconect_socket="dissconectSocket" | ||
28 | @toogle_group_maker="toogleGroupShow" | 29 | @toogle_group_maker="toogleGroupShow" |
29 | @group_set="openGroup" | 30 | @group_set="openGroup" |
30 | /> | 31 | /> |
@@ -57,7 +58,7 @@ export default { | |||
57 | this.$store.dispatch('logout') | 58 | this.$store.dispatch('logout') |
58 | this.$router.push('/login') | 59 | this.$router.push('/login') |
59 | }, | 60 | }, |
60 | 61 | ||
61 | toogleSearcherShow() { | 62 | toogleSearcherShow() { |
62 | this.popups.searcher_show = !this.popups.searcher_show | 63 | this.popups.searcher_show = !this.popups.searcher_show |
63 | this.popups.group_maker_show = false | 64 | this.popups.group_maker_show = false |
@@ -65,8 +66,11 @@ export default { | |||
65 | hideSearcher() { this.popups.searcher_show = false }, | 66 | hideSearcher() { this.popups.searcher_show = false }, |
66 | 67 | ||
67 | toogleGroupShow() { this.popups.group_maker_show = !this.popups.group_maker_show }, | 68 | toogleGroupShow() { this.popups.group_maker_show = !this.popups.group_maker_show }, |
69 | |||
68 | hideGroup() { this.popups.group_maker_show = false }, | 70 | hideGroup() { this.popups.group_maker_show = false }, |
69 | 71 | ||
72 | dissconectSocket() { this.socket.disconnect() }, | ||
73 | |||
70 | openGroup(group) { | 74 | openGroup(group) { |
71 | let groups = this.groups.slice() | 75 | let groups = this.groups.slice() |
72 | let index = groups.findIndex(o => o.name===group.name) | 76 | let index = groups.findIndex(o => o.name===group.name) |
@@ -132,7 +136,7 @@ export default { | |||
132 | }); | 136 | }); |
133 | 137 | ||
134 | this.socket.on("disconnect", () => { | 138 | this.socket.on("disconnect", () => { |
135 | console.log("Scoket dsiconected") | 139 | console.log("Scoket dsiconected!") |
136 | }) | 140 | }) |
137 | 141 | ||
138 | this.socket.on("receive_group_message", async ({message}) => { | 142 | this.socket.on("receive_group_message", async ({message}) => { |