MCPcopy Create free account
hub / github.com/Fernanda-Kipper/text-editor / useFileDelete

Function useFileDelete

src/hooks/useFileDelete.ts:30–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28}
29
30export 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}

Callers 1

FileItemFunction · 0.90

Calls 1

updateFileFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…