[FIX] Offline PWA functionality and style offline page

This commit is contained in:
2023-03-12 12:57:19 +00:00
parent d65ccc807f
commit 4e4503e097
2 changed files with 11 additions and 2 deletions

View File

@@ -1,9 +1,10 @@
var staticCacheName = "django-pwa-v" + new Date().getTime();
var filesToCache = [
"/offline",
"/offline/",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/fontawesome.min.css",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/solid.min.css",
"/static/css/global.css",
"/static/js/serviceworker.js",
"/static/hijack/hijack.min.css",
"/media/icon-192x192.png",
];
@@ -41,7 +42,7 @@ self.addEventListener("fetch", event => {
return response || fetch(event.request);
})
.catch(() => {
return caches.match('offline');
return caches.match('/offline/');
})
)
});

View File

@@ -0,0 +1,8 @@
{% extends 'base.html' %}
{% block content %}
<h2>Offline</h2>
<p>You are currently offline. Please connect to a network to use this platform.</p>
{% endblock %}