offline online network
Add event listeners for checking the network status. Capturing those events lets you handle offline and online status of the application.
window.addEventListener('online', ()=> console.log("online"));
window.addEventListener('offline', ()=> console.log("offline"));
copy