PWA offline try to check if offline

This commit is contained in:
Louis DUMONT 2022-03-30 11:35:47 +02:00
parent 16eab3f5d7
commit b14b5443aa
2 changed files with 21 additions and 19 deletions

View File

@ -1,6 +1,10 @@
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// [ Form Login ] // [ Form Login ]
(function ($) { (function ($) {
if (!window.navigator.onLine){
console.log("offline");
$(".info_message").show();
}
"use strict"; "use strict";
var input = $('.validate-input .input-forms'); var input = $('.validate-input .input-forms');
$('.validate').on('submit',(function(){ $('.validate').on('submit',(function(){
@ -14,7 +18,6 @@
} }
if (check){ if (check){
if (window.navigator.onLine){
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: 'controller/Auth.php', url: 'controller/Auth.php',
@ -30,9 +33,7 @@
}, 1000); }, 1000);
} }
}}); }});
} else {
$(".info_message").show();
}
} }
check = false; check = false;
return check; return check;

View File

@ -18,6 +18,7 @@ self.addEventListener('install', (e) => {
'index.php', 'index.php',
'http://ctsstatic.fr/assets/css/index.css', 'http://ctsstatic.fr/assets/css/index.css',
'http://ctsstatic.fr/assets/js/index.js', 'http://ctsstatic.fr/assets/js/index.js',
'http://ctsstatic.fr/assets/images/logo_petit.png',
'http://ctsstatic.fr/assets/vendors/jquery/jquery-3.6.0.min.js' 'http://ctsstatic.fr/assets/vendors/jquery/jquery-3.6.0.min.js'
]; ];