mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 01:05:53 +03:00
fix typescript complaining
This commit is contained in:
parent
a9b72c6d28
commit
2f610eb955
1 changed files with 28 additions and 19 deletions
|
@ -30,8 +30,6 @@ import MutationButton from "../../../../components/form/mutation-button";
|
||||||
export default function DomainPermissionExcludeDetail() {
|
export default function DomainPermissionExcludeDetail() {
|
||||||
const baseUrl = useBaseUrl();
|
const baseUrl = useBaseUrl();
|
||||||
const backLocation: string = history.state?.backLocation ?? `~${baseUrl}`;
|
const backLocation: string = history.state?.backLocation ?? `~${baseUrl}`;
|
||||||
const [_location, setLocation] = useLocation();
|
|
||||||
const [ deleteExclude, deleteResult ] = useDeleteDomainPermissionExcludeMutation();
|
|
||||||
|
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
let id = params.excludeId as string | undefined;
|
let id = params.excludeId as string | undefined;
|
||||||
|
@ -86,25 +84,36 @@ export default function DomainPermissionExcludeDetail() {
|
||||||
<dd>{privateComment}</dd>
|
<dd>{privateComment}</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
<MutationButton
|
<HandleExclude
|
||||||
label={`Delete exclude`}
|
id={id}
|
||||||
title={`Delete exclude`}
|
backLocation={backLocation}
|
||||||
type="button"
|
|
||||||
className="button danger"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
deleteExclude(id).then(res => {
|
|
||||||
if ("data" in res) {
|
|
||||||
setLocation(backLocation);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
disabled={false}
|
|
||||||
showError={true}
|
|
||||||
result={deleteResult}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function HandleExclude({ id, backLocation}: {id: string, backLocation: string}) {
|
||||||
|
const [_location, setLocation] = useLocation();
|
||||||
|
const [ deleteExclude, deleteResult ] = useDeleteDomainPermissionExcludeMutation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MutationButton
|
||||||
|
label={`Delete exclude`}
|
||||||
|
title={`Delete exclude`}
|
||||||
|
type="button"
|
||||||
|
className="button danger"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
deleteExclude(id).then(res => {
|
||||||
|
if ("data" in res) {
|
||||||
|
setLocation(backLocation);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
disabled={false}
|
||||||
|
showError={true}
|
||||||
|
result={deleteResult}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue