diff --git a/app/components/settings/notifications.tsx b/app/components/settings/notifications.tsx index ff151ca..392832a 100644 --- a/app/components/settings/notifications.tsx +++ b/app/components/settings/notifications.tsx @@ -132,11 +132,12 @@ export default function NotificationSettings() { const currentSubscriptionId = localStorage.getItem(STORAGE_KEY); const currentSubscription = notifications.find( - (sub) => sub.id === currentSubscriptionId + (sub) => sub.id.toString() === currentSubscriptionId ); useEffect(() => { setEvents(currentSubscription?.events || []); - if (pushEnabled && !currentSubscription) { + // Remove pushEnabled if no current subscription (i.e., user unsubscribed) + if (!isLoading && !isError && pushEnabled && !currentSubscription) { setPushEnabled(false); localStorage.removeItem(STORAGE_KEY); } @@ -228,9 +229,9 @@ export default function NotificationSettings() { {currentSubscription && ( - Select Notification Events + Configurer vos notifications - Choose which events you want to receive notifications for + Choisissez les événements qui déclencheront une notification. @@ -264,7 +265,7 @@ export default function NotificationSettings() { onClick={() => updateSubscription( currentSubscription.id, - events.map((event) => event.id) + events.filter((e) => e.enabled).map((e) => e.id) ) .then(() => { toast.success(