| 1 |
import { useCallback } from 'react'; |
| 2 |
import { useMutation } from 'react-query'; |
| 3 |
|
| 4 |
export default function useDownloadLinkMutation( model, { onError, onSuccess } ) { |
| 5 |
const downloadLink = useCallback( |
| 6 |
() => $e.data.get( 'kits/download-link', { id: model.id }, { refresh: true } ), |
| 7 |
[ model ], |
| 8 |
); |
| 9 |
|
| 10 |
return useMutation( |
| 11 |
downloadLink, |
| 12 |
{ onSuccess, onError }, |
| 13 |
); |
| 14 |
} |
| 15 |
|