diff options
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/Home.vue | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/views/Home.vue b/src/views/Home.vue index 7bd99a2..d85760b 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue | |||
@@ -5,6 +5,7 @@ | |||
5 | <div v-for="group in groups" :key="group.name" > | 5 | <div v-for="group in groups" :key="group.name" > |
6 | <GroupSender | 6 | <GroupSender |
7 | :group="group" | 7 | :group="group" |
8 | :socket="socket" | ||
8 | /> | 9 | /> |
9 | </div> | 10 | </div> |
10 | 11 | ||
@@ -26,6 +27,7 @@ | |||
26 | import Searcher from '@/components/searcher/Searcher.vue' | 27 | import Searcher from '@/components/searcher/Searcher.vue' |
27 | import GroupMaker from '@/components/group/GroupMaker.vue' | 28 | import GroupMaker from '@/components/group/GroupMaker.vue' |
28 | import GroupSender from '@/components/group/GroupSender.vue' | 29 | import GroupSender from '@/components/group/GroupSender.vue' |
30 | import io from 'socket.io-client' | ||
29 | 31 | ||
30 | const popups = { | 32 | const popups = { |
31 | searcher_show: false, | 33 | searcher_show: false, |
@@ -36,7 +38,8 @@ export default { | |||
36 | data() { | 38 | data() { |
37 | return { | 39 | return { |
38 | popups, | 40 | popups, |
39 | groups: [] | 41 | groups: [], |
42 | socket: Object | ||
40 | } | 43 | } |
41 | }, | 44 | }, |
42 | 45 | ||
@@ -92,6 +95,18 @@ export default { | |||
92 | if(!this.$store.getters['is_logged_in']) { | 95 | if(!this.$store.getters['is_logged_in']) { |
93 | this.$router.push('/login') | 96 | this.$router.push('/login') |
94 | } | 97 | } |
98 | |||
99 | this.socket = io() | ||
100 | this.socket.auth = { token: this.$store.getters.get_token }; | ||
101 | this.socket.connect(); | ||
102 | |||
103 | this.socket.on("connect", () => { | ||
104 | console.log("Socket connected!") | ||
105 | }); | ||
106 | |||
107 | this.socket.on("disconnect", () => { | ||
108 | console.log("Scoket dsiconected") | ||
109 | }) | ||
95 | } | 110 | } |
96 | 111 | ||
97 | } | 112 | } |