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