1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-05 14:26:16 +00:00

Fix: show no connection error modal, if app is not initialized

This commit is contained in:
jcorporation 2019-01-14 23:13:57 +00:00
parent 2f3a579d07
commit 597268aca6
2 changed files with 8 additions and 5 deletions

View File

@ -619,7 +619,7 @@
</footer>
<!-- Modals -->
<div class="modal fade" id="modalAppInit" tabindex="-1">
<div class="modal" id="modalAppInit" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-success text-light">

View File

@ -1048,7 +1048,7 @@ function webSocketConnect() {
try {
socket.onopen = function() {
console.log('connected');
console.log('Websocket is connected');
showNotification('Connected to myMPD: ' + wsUrl, '', '', 'success');
modalConnectionError.hide();
appRoute();
@ -1111,11 +1111,14 @@ function webSocketConnect() {
}
socket.onclose = function(){
console.log('Websocket is disconnected');
if (websocketConnected == true) {
//Show modal only if websocket was already connected before
modalConnectionError.show();
}
websocketConnected = false;
console.log('disconnected');
modalConnectionError.show();
setTimeout(function() {
console.log('reconnect');
console.log('Reconnecting websocket');
webSocketConnect();
}, 3000);
}