1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00

🔧 Simplify GroupDeleteButton

This commit is contained in:
Steffo 2021-10-12 03:36:29 +02:00
parent bbab78c60c
commit beaf162ce5

View file

@ -15,14 +15,6 @@ export interface GroupDeleteButtonProps {
export function GroupDeleteButton({resource}: GroupDeleteButtonProps): JSX.Element | null {
const authorization = useAuthorizationContext()
const doDelete =
React.useCallback(
async () => {
await resource.destroy()
},
[resource],
)
if(!authorization) {
return null
}
@ -34,7 +26,7 @@ export function GroupDeleteButton({resource}: GroupDeleteButtonProps): JSX.Eleme
}
return (
<SafetyButton timeout={3} onClick={doDelete}>
<SafetyButton timeout={3} onClick={() => resource.destroy()}>
<FontAwesomeIcon icon={faTrash} pulse={resource.busy}/>&nbsp;Delete
</SafetyButton>
)