add error handling for notification setting update

This commit is contained in:
Dany Khalife 2024-12-27 10:27:17 -08:00
parent 577791b4ad
commit 562f5f66fe
No known key found for this signature in database
GPG key ID: 76E792CED919B0DA

View file

@ -45,7 +45,11 @@ const NotificationSetting = () => {
target: chatID, target: chatID,
type: Number(notificationTarget), type: Number(notificationTarget),
}).then(resp => { }).then(resp => {
alert('Notification target updated') if (resp.status != 200) {
alert(`Error while updating notification target: ${resp.statusText}`)
return
}
setUserProfile({ setUserProfile({
...userProfile, ...userProfile,
notification_target: { notification_target: {
@ -53,6 +57,7 @@ const NotificationSetting = () => {
type: Number(notificationTarget), type: Number(notificationTarget),
}, },
}) })
alert('Notification target updated')
}) })
} }
return ( return (