File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<template >
22 <div id =' app' >
3- <ib-disconnect ></ib-disconnect >
43 <ib-notifications ></ib-notifications >
54 <md-toolbar >
65 <md-button v-if =" $store.state.user" class =" md-icon-button" @click =" toggleLeftSidenav" >
1211 </a >
1312 </div >
1413 <h2 class =" md-title" style =" flex : 1 " ></h2 >
14+
15+ <md-button v-if =" $store.state.user && !connected" class =" md-button" @click =" reconnect" md-right >
16+ <i class =" fa fa-fw fa-bolt" ></i > Disconnected
17+ </md-button >
1518 <md-button v-if =" !$store.state.user" class =" md-button" @click =" login" md-right >
1619 <i class =" fa fa-sign-in" ></i > Login
1720 </md-button >
118121<script >
119122import store from ' ./store'
120123import router from ' ./router'
121- import Disconnect from ' ./components/utils/Disconnect '
124+ import events from ' ./events '
122125import UserService from ' ./services/UserService'
123126
124127export default {
125128 name: ' app' ,
126- components: {
127- ' ib-disconnect' : Disconnect
129+ data () {
130+ return {
131+ connected: true
132+ }
128133 },
129134 store,
135+ created () {
136+ events .$on (' DISCONNECTED' , () => {
137+ this .connected = false
138+ })
139+
140+ events .$on (' CONNECTED' , () => {
141+ this .connected = true
142+ })
143+ },
130144 methods: {
145+ reconnect () {
146+ window .location .reload (false )
147+ },
131148 toggleLeftSidenav () {
132149 this .$refs .leftSidenav .toggle ()
133150 },
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ Vue.use(VueSocketio, socket)
2222
2323export default new Vue ( {
2424 sockets : {
25+ connect ( ) {
26+ this . $emit ( 'CONNECTED' )
27+ } ,
2528 disconnect ( ) {
2629 this . $emit ( 'DISCONNECTED' )
2730 } ,
You can’t perform that action at this time.
0 commit comments