mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-23 07:14:21 +00:00
🔧 Simplify GroupDeleteButton
This commit is contained in:
parent
ffacc3e1f4
commit
3c0c8d1e73
1 changed files with 1 additions and 9 deletions
|
@ -15,14 +15,6 @@ export interface GroupDeleteButtonProps {
|
||||||
export function GroupDeleteButton({resource}: GroupDeleteButtonProps): JSX.Element | null {
|
export function GroupDeleteButton({resource}: GroupDeleteButtonProps): JSX.Element | null {
|
||||||
const authorization = useAuthorizationContext()
|
const authorization = useAuthorizationContext()
|
||||||
|
|
||||||
const doDelete =
|
|
||||||
React.useCallback(
|
|
||||||
async () => {
|
|
||||||
await resource.destroy()
|
|
||||||
},
|
|
||||||
[resource],
|
|
||||||
)
|
|
||||||
|
|
||||||
if(!authorization) {
|
if(!authorization) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -34,7 +26,7 @@ export function GroupDeleteButton({resource}: GroupDeleteButtonProps): JSX.Eleme
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafetyButton timeout={3} onClick={doDelete}>
|
<SafetyButton timeout={3} onClick={() => resource.destroy()}>
|
||||||
<FontAwesomeIcon icon={faTrash} pulse={resource.busy}/> Delete
|
<FontAwesomeIcon icon={faTrash} pulse={resource.busy}/> Delete
|
||||||
</SafetyButton>
|
</SafetyButton>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue