Prevent push enable prompt (inbox) when already subscribed

This commit is contained in:
Karina Kwiatek 2023-01-05 23:20:36 +01:00
parent 992f31676c
commit 4457f2ed26

View file

@ -14,6 +14,7 @@ export default (): void => {
navigator.serviceWorker.getRegistration().then(async registration => { navigator.serviceWorker.getRegistration().then(async registration => {
const subscription = await registration?.pushManager.getSubscription(); const subscription = await registration?.pushManager.getSubscription();
if (subscription) { if (subscription) {
document.querySelector('.push-settings')?.classList.add('d-none');
document.querySelector('button[data-action="push-enable"]')?.classList.add('d-none'); document.querySelector('button[data-action="push-enable"]')?.classList.add('d-none');
document.querySelector('[data-action="push-disable"]')?.classList.remove('d-none'); document.querySelector('[data-action="push-disable"]')?.classList.remove('d-none');