feat(web): introduce folders to organize flows
This commit is contained in:
23
packages/web/src/hooks/useUpdateFlowFolder.js
Normal file
23
packages/web/src/hooks/useUpdateFlowFolder.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useUpdateFlowFolder(flowId) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (folderId) => {
|
||||
const { data } = await api.patch(`/v1/flows/${flowId}/folder`, {
|
||||
folderId,
|
||||
});
|
||||
|
||||
return data;
|
||||
},
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ['flows', flowId, 'folder'],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return mutation;
|
||||
}
|
||||
Reference in New Issue
Block a user