Skip to content

Commit

Permalink
force update when WS isnt connected
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriolino committed Jul 14, 2018
1 parent 043a808 commit 05d6dec
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Resources/public/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
servicos: [],
atendimento: null,
novoServico: '',
novaPrioridade: ''
novaPrioridade: '',
connected: false
},
methods: {
init: function () {
Expand All @@ -34,11 +35,13 @@
App.Websocket.on('reconnect_failed', function () {
App.Websocket.connect();
console.log('ws timeout, ajax polling fallback');
self.connected = false;
self.update();
});

App.Websocket.on('register ok', function () {
console.log('registered!');
self.connected = true;
});

App.Websocket.on('update queue', function () {
Expand Down Expand Up @@ -129,6 +132,10 @@
unity: unidade.id
});
$('.modal').modal('hide');

if (!self.connected) {
self.update();
}
}
});
});
Expand Down Expand Up @@ -159,6 +166,10 @@
unity: unidade.id
});
$('.modal').modal('hide');

if (!self.connected) {
self.update();
}
}
});
});
Expand Down Expand Up @@ -189,6 +200,10 @@
unity: unidade.id
});
$('.modal').modal('hide');

if (!self.connected) {
self.update();
}
}
});
});
Expand Down

0 comments on commit 05d6dec

Please sign in to comment.