[Glitch] Fix 404 error after deleting status from detail view
Port d93572ea90 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
1 parent
6abe6cdef5
commit
bf3c53661a
4 files changed
+54
-8
No files matched your search
+12
-3
@@ -40,14 +40,23 @@ export const ConfirmDeleteStatusModal: React.FC<
|
||||
{
|
||||
statusId: string;
|
||||
withRedraft: boolean;
|
||||
onDeleteSuccess?: () => void;
|
||||
} & BaseConfirmationModalProps
|
||||
> = ({ statusId, withRedraft, onClose }) => {
|
||||
> = ({ statusId, withRedraft, onClose, onDeleteSuccess }) => {
|
||||
const intl = useIntl();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const onConfirm = useCallback(() => {
|
||||
dispatch(deleteStatus(statusId, withRedraft));
|
||||
}, [dispatch, statusId, withRedraft]);
|
||||
void dispatch(deleteStatus(statusId, withRedraft))
|
||||
.then(() => {
|
||||
onDeleteSuccess?.();
|
||||
onClose();
|
||||
})
|
||||
.catch(() => {
|
||||
// Error handling - still close modal
|
||||
onClose();
|
||||
});
|
||||
}, [dispatch, statusId, withRedraft, onDeleteSuccess, onClose]);
|
||||
|
||||
return (
|
||||
<ConfirmationModal
|
||||
|
||||
Reference in new issue
Block a user