From fc6a6b08164cbf77cb05e04b519487966fbcfee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Tue, 6 Jan 2026 08:02:21 +0300 Subject: [PATCH] fix: Close catch block in _checkSubscription Missing closing brace after catch block caused syntax error --- .../js/notifications/push-notifications.js | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/backend/static/js/notifications/push-notifications.js b/backend/static/js/notifications/push-notifications.js index 0b853f3e..241ec495 100644 --- a/backend/static/js/notifications/push-notifications.js +++ b/backend/static/js/notifications/push-notifications.js @@ -134,26 +134,27 @@ class PushNotificationsManager { localStorage.setItem('push_endpoint', currentEndpoint); } catch (error) { console.warn('[PushNotifications] Ошибка синхронизации, переподписываемся:', error); - - // Если ошибка - возможно VAPID ключи изменились - // Удаляем старую подписку и создаём новую - try { - await subscription.unsubscribe(); - console.log('[PushNotifications] Старая подписка удалена'); - // Создаём новую подписку с новыми VAPID ключами - const newSubscription = await this.swRegistration.pushManager.subscribe({ - userVisibleOnly: true, - applicationServerKey: this._urlBase64ToUint8Array(this.vapidPublicKey) - }); - - await this._sendSubscriptionToServer(newSubscription); - localStorage.setItem('push_endpoint', newSubscription.endpoint); - console.log('[PushNotifications] ✅ Автоматически переподписались'); - this.isSubscribed = true; - } catch (resubscribeError) { - console.error('[PushNotifications] Ошибка переподписки:', resubscribeError); - this.isSubscribed = false; + // Если ошибка - возможно VAPID ключи изменились + // Удаляем старую подписку и создаём новую + try { + await subscription.unsubscribe(); + console.log('[PushNotifications] Старая подписка удалена'); + + // Создаём новую подписку с новыми VAPID ключами + const newSubscription = await this.swRegistration.pushManager.subscribe({ + userVisibleOnly: true, + applicationServerKey: this._urlBase64ToUint8Array(this.vapidPublicKey) + }); + + await this._sendSubscriptionToServer(newSubscription); + localStorage.setItem('push_endpoint', newSubscription.endpoint); + console.log('[PushNotifications] ✅ Автоматически переподписались'); + this.isSubscribed = true; + } catch (resubscribeError) { + console.error('[PushNotifications] Ошибка переподписки:', resubscribeError); + this.isSubscribed = false; + } } } }