diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-11-10 20:26:04 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-11-12 13:54:09 +0100 |
commit | 5394ca6807d4524e27129f8bb6eaf067bfd2020d (patch) | |
tree | d06c852e9e6f7b75412fb77a7d5b1ee827397378 | |
parent | 487689f062877c49f5eb7cc75695f676c8db80cc (diff) |
[Glitch] Fix unnecessary service worker registration and preloading when logged out
Port 894ce3726a38733ea7b8c880658b962f92d021ae to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r-- | app/javascript/flavours/glitch/main.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/javascript/flavours/glitch/main.js b/app/javascript/flavours/glitch/main.js index f1e10df34..b8095f819 100644 --- a/app/javascript/flavours/glitch/main.js +++ b/app/javascript/flavours/glitch/main.js @@ -25,17 +25,17 @@ function main() { import('flavours/glitch/initial_state'), ]); - const wb = new Workbox('/sw.js'); + if (me) { + const wb = new Workbox('/sw.js'); - try { - await wb.register(); - } catch (err) { - console.error(err); + try { + await wb.register(); + } catch (err) { + console.error(err); - return; - } + return; + } - if (me) { const registerPushNotifications = await import('flavours/glitch/actions/push_notifications'); store.dispatch(registerPushNotifications.register()); |