()
| 28 | } |
| 29 | |
| 30 | export function useFileDelete(){ |
| 31 | const queryClient = useQueryClient() |
| 32 | const { data, isLoading, isError, isSuccess, mutate } = useMutation( |
| 33 | (data: MutationInput) => updateFile(data.id, data.query), |
| 34 | {onSuccess: () => queryClient.invalidateQueries('files')} |
| 35 | ); |
| 36 | |
| 37 | const deleteFile = (fileId: string) => { |
| 38 | if(!fileId) return |
| 39 | return mutate({ id: fileId, query: generateDeleteQuery(fileId)}) |
| 40 | } |
| 41 | |
| 42 | return { |
| 43 | deleteFile, |
| 44 | isSuccess, |
| 45 | data, |
| 46 | isLoading, |
| 47 | isError |
| 48 | } |
| 49 | } |
no test coverage detected
searching dependent graphs…