Skip to content

Commit

Permalink
feat: refetch project detail on image processing starter api success
Browse files Browse the repository at this point in the history
  • Loading branch information
suzit-10 committed Jan 16, 2025
1 parent 7eb041e commit 8b311ae
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import '@hotosm/gcp-editor';
import '@hotosm/gcp-editor/style.css';
import { useDispatch } from 'react-redux';
import { setProjectState } from '@Store/actions/project';
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { processAllImagery } from '@Services/project';
import { useParams } from 'react-router-dom';

Expand All @@ -16,10 +16,12 @@ const GcpEditor = ({
const { id } = useParams();
const dispatch = useDispatch();
const CUSTOM_EVENT: any = 'start-processing-click';
const queryClient = useQueryClient();

const { mutate: startImageProcessing } = useMutation({
mutationFn: processAllImagery,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['project-detail'] });
dispatch(setProjectState({ showGcpEditor: false }));
},
});
Expand Down

0 comments on commit 8b311ae

Please sign in to comment.