A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
refactor: Update BadgeModal component to handle badge cancellation and confirmation
robin34684cdf7053
diff --git a/ui/src/components/Modal/BadgeModal.tsx b/ui/src/components/Modal/BadgeModal.tsxindex 214c1d67..32049de6 100644--- a/ui/src/components/Modal/BadgeModal.tsx+++ b/ui/src/components/Modal/BadgeModal.tsx@@ -19,14 +19,21 @@ const BadgeModal: FC<BadgeModalProps> = ({ badge, visible }) => {const { t } = useTranslation('translation', { keyPrefix: 'badges.modal' });const { user } = loggedUserInfoStore();const navigate = useNavigate();- const { data } = useQueryNotificationStatus();+ const { data, mutate } = useQueryNotificationStatus();- const handleCancel = async () => {+ const handle = async () => {if (!data) return;await readNotification(badge?.notification_id);+ await mutate({+ ...data,+ badge_award: null,+ });+ };+ const handleCancel = async () => {+ await handle();};const handleConfirm = async () => {- await readNotification(badge?.notification_id);+ await handle();const url = `/badges/${badge?.badge_id}?username=${user.username}`;navigate(url);