fix(webpush): store push notification status in localStorage

Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me>
This commit is contained in:
0xsysr3ll
2025-12-07 15:09:30 +01:00
parent bde07e02c1
commit 4dbb7cdf2d

View File

@@ -163,12 +163,15 @@ const UserWebPushSettings = () => {
const verifyWebPush = async () => { const verifyWebPush = async () => {
const enabled = await verifyPushSubscription(user?.id, currentSettings); const enabled = await verifyPushSubscription(user?.id, currentSettings);
setWebPushEnabled(enabled); setWebPushEnabled(enabled);
if (enabled) {
localStorage.setItem('pushNotificationsEnabled', 'true');
}
}; };
if (user?.id) { if (user?.id) {
verifyWebPush(); verifyWebPush();
} }
}, [user?.id, currentSettings]); }, [user?.id, currentSettings, dataDevices]);
useEffect(() => { useEffect(() => {
const getSubscriptionEndpoint = async () => { const getSubscriptionEndpoint = async () => {