Handle error from API on Group Save

This commit is contained in:
Chewbacca
2023-04-12 16:56:56 -04:00
parent 3f4bbe6f55
commit cd890c8641
2 changed files with 19 additions and 4 deletions

View File

@@ -62,10 +62,20 @@ const EditGroup: React.FC<IEditGroup> = ({ params: { id: groupId } }) => {
avatar: avatar.file,
header: header.file,
tags,
}, {
onSuccess() {
toast.success(intl.formatMessage(messages.groupSaved));
},
onError(error) {
const message = (error.response?.data as any)?.error;
if (error.response?.status === 422 && typeof message !== 'undefined') {
toast.error(message);
}
},
});
setIsSubmitting(false);
toast.success(intl.formatMessage(messages.groupSaved));
}
const handleAddTag = () => {