From 562f5f66fe8c73b9c2b39e672441cfd955436897 Mon Sep 17 00:00:00 2001 From: Dany Khalife Date: Fri, 27 Dec 2024 10:27:17 -0800 Subject: [PATCH] add error handling for notification setting update --- src/views/Settings/NotificationSetting.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/views/Settings/NotificationSetting.jsx b/src/views/Settings/NotificationSetting.jsx index 5a09ecd..8f55f96 100644 --- a/src/views/Settings/NotificationSetting.jsx +++ b/src/views/Settings/NotificationSetting.jsx @@ -45,7 +45,11 @@ const NotificationSetting = () => { target: chatID, type: Number(notificationTarget), }).then(resp => { - alert('Notification target updated') + if (resp.status != 200) { + alert(`Error while updating notification target: ${resp.statusText}`) + return + } + setUserProfile({ ...userProfile, notification_target: { @@ -53,6 +57,7 @@ const NotificationSetting = () => { type: Number(notificationTarget), }, }) + alert('Notification target updated') }) } return (