fix(webpush): store push notification status in localStorage
Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me>
This commit is contained in:
@@ -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 () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user