diff --git a/web/source/settings/views/moderation/domain-permissions/excludes/detail.tsx b/web/source/settings/views/moderation/domain-permissions/excludes/detail.tsx index a3f9d2e4b..4e14ec3ad 100644 --- a/web/source/settings/views/moderation/domain-permissions/excludes/detail.tsx +++ b/web/source/settings/views/moderation/domain-permissions/excludes/detail.tsx @@ -30,8 +30,6 @@ import MutationButton from "../../../../components/form/mutation-button"; export default function DomainPermissionExcludeDetail() { const baseUrl = useBaseUrl(); const backLocation: string = history.state?.backLocation ?? `~${baseUrl}`; - const [_location, setLocation] = useLocation(); - const [ deleteExclude, deleteResult ] = useDeleteDomainPermissionExcludeMutation(); const params = useParams(); let id = params.excludeId as string | undefined; @@ -86,25 +84,36 @@ export default function DomainPermissionExcludeDetail() {
{privateComment}
- { - e.preventDefault(); - e.stopPropagation(); - deleteExclude(id).then(res => { - if ("data" in res) { - setLocation(backLocation); - } - }); - }} - disabled={false} - showError={true} - result={deleteResult} + ); } +function HandleExclude({ id, backLocation}: {id: string, backLocation: string}) { + const [_location, setLocation] = useLocation(); + const [ deleteExclude, deleteResult ] = useDeleteDomainPermissionExcludeMutation(); + + return ( + { + e.preventDefault(); + e.stopPropagation(); + deleteExclude(id).then(res => { + if ("data" in res) { + setLocation(backLocation); + } + }); + }} + disabled={false} + showError={true} + result={deleteResult} + /> + ); +}