Fix unnecessary service worker registration and preloading when logged out (#20341)
This commit is contained in:
parent
397845453e
commit
894ce3726a
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue