Fix unnecessary service worker registration and preloading when logged out (#20341)

lolsob-rspec
Claire 2022-11-10 20:26:04 +01:00 committed by GitHub
parent 88976fb615
commit 9b878a14eb
1 changed files with 10 additions and 10 deletions

View File

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