chore: fix notification events
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m26s
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m26s
This commit is contained in:
parent
2e12b2cec7
commit
aa88fbda44
1 changed files with 6 additions and 5 deletions
|
|
@ -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 && (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Select Notification Events</CardTitle>
|
||||
<CardTitle>Configurer vos notifications</CardTitle>
|
||||
<CardDescription>
|
||||
Choose which events you want to receive notifications for
|
||||
Choisissez les événements qui déclencheront une notification.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue