From 711ab04789b3c3380ba1dd09a32774c17e93de4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sun, 9 Feb 2020 15:25:36 +0100 Subject: fixed missing cache in case of a logout --- js/logout.js | 3 ++- js/timetable.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/logout.js b/js/logout.js index b4b36be..f9c2543 100644 --- a/js/logout.js +++ b/js/logout.js @@ -1,4 +1,5 @@ -navigator.serviceWorker.controller.postMessage(JSON.stringify({action: "deletecaches"})); // deletes cache +// navigator.serviceWorker.controller.postMessage(JSON.stringify({action: "deletecaches"})); // cache only sets on initialization, so it should not be deleted. +// since sw.js is not cached, updates work. localforage.clear().then(() => { // deletes localforage window.location.replace("/index.html"); }); diff --git a/js/timetable.js b/js/timetable.js index 30ddffa..0f85f24 100644 --- a/js/timetable.js +++ b/js/timetable.js @@ -109,7 +109,7 @@ async function loadTimetable(date_object, force_refresh = false) { await Promise.all(promises_to_run); - if (force_refresh || timetable === null || !(date_string in timetable)) { + if (force_refresh || timetable == null || !(date_string in timetable)) { $.ajax({ url: API_ENDPOINT, crossDomain: true, @@ -294,4 +294,4 @@ document.addEventListener("DOMContentLoaded", () => { // Setup side modal const modals = document.querySelectorAll('.side-modal'); M.Sidenav.init(modals, { edge: 'left', draggable: false }); -}); \ No newline at end of file +}); -- cgit v1.2.3