Skip to content

Commit

Permalink
front: transform postInfraByInfraIdPathProperties into query
Browse files Browse the repository at this point in the history
Signed-off-by: Clara Ni <[email protected]>
  • Loading branch information
clarani committed Nov 28, 2024
1 parent c70e43e commit 8124752
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const useSetupItineraryForTrainUpdate = (
const [postPathfindingBlocks] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathfindingBlocks.useLazyQuery();
const [postPathProperties] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useMutation();
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useLazyQuery();
const { infraId } = useScenarioContext();

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion front/src/applications/stdcm/hooks/useStdcmResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const useStdcmResults = (
const selectedTrainId = useSelector(getSelectedTrainId);

const [postPathProperties] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useMutation();
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useLazyQuery();

const { data: otherSelectedTrainSchedule } =
osrdEditoastApi.endpoints.getTrainScheduleById.useQuery(
Expand Down
4 changes: 2 additions & 2 deletions front/src/common/api/generatedEditoastApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const injectedRtkApi = api
}),
providesTags: ['infra'],
}),
postInfraByInfraIdPathProperties: build.mutation<
postInfraByInfraIdPathProperties: build.query<
PostInfraByInfraIdPathPropertiesApiResponse,
PostInfraByInfraIdPathPropertiesApiArg
>({
Expand All @@ -290,7 +290,7 @@ const injectedRtkApi = api
body: queryArg.pathPropertiesInput,
params: { props: queryArg.props },
}),
invalidatesTags: ['pathfinding'],
providesTags: ['pathfinding'],
}),
postInfraByInfraIdPathfinding: build.query<
PostInfraByInfraIdPathfindingApiResponse,
Expand Down
1 change: 1 addition & 0 deletions front/src/config/openapi-editoast-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const config: ConfigFile = {
'postInfraByInfraIdObjectsAndObjectType',
'postInfraByInfraIdPathfinding',
'postInfraByInfraIdPathfindingBlocks',
'postInfraByInfraIdPathProperties',
'postTrainSchedule',
'postTrainScheduleSimulationSummary',
'postTrainScheduleProjectPath',
Expand Down
2 changes: 1 addition & 1 deletion front/src/modules/pathfinding/hooks/usePathProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const usePathProperties = (
const [pathProperties, setPathProperties] = useState<PathProperties>();

const [postPathProperties] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useMutation();
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useLazyQuery();

useEffect(() => {
const getPathProperties = async () => {
Expand Down
2 changes: 1 addition & 1 deletion front/src/modules/pathfinding/hooks/usePathfinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const usePathfinding = (
const [postPathfindingBlocks] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathfindingBlocks.useLazyQuery();
const [postPathProperties] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useMutation();
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useLazyQuery();

const { updatePathSteps } = useOsrdConfActions();
const { infraId } = useScenarioContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const useGetProjectedTrainOperationalPoints = (
);

const [postPathProperties] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useMutation();
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useLazyQuery();

useEffect(() => {
const getOperationalPoints = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useProjectedConflicts = (
path: PathfindingResultSuccess | undefined
) => {
const [postPathProperties] =
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useMutation();
osrdEditoastApi.endpoints.postInfraByInfraIdPathProperties.useLazyQuery();

const [projectedZones, setProjectedZones] = useState<PathProperties['zones']>();
useEffect(() => {
Expand Down

0 comments on commit 8124752

Please sign in to comment.