[Glitch] Fix unnecessary service worker registration and preloading when logged out

Port 894ce3726a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
local
Claire 2 years ago
parent 487689f062
commit 5394ca6807
  1. 16
      app/javascript/flavours/glitch/main.js

@ -25,17 +25,17 @@ function main() {
import('flavours/glitch/initial_state'), import('flavours/glitch/initial_state'),
]); ]);
const wb = new Workbox('/sw.js'); if (me) {
const wb = new Workbox('/sw.js');
try { try {
await wb.register(); await wb.register();
} catch (err) { } catch (err) {
console.error(err); console.error(err);
return; return;
} }
if (me) {
const registerPushNotifications = await import('flavours/glitch/actions/push_notifications'); const registerPushNotifications = await import('flavours/glitch/actions/push_notifications');
store.dispatch(registerPushNotifications.register()); store.dispatch(registerPushNotifications.register());

Loading…
Cancel
Save