1
This commit is contained in:
30
ems-frontend/ems-monitoring-system/src/api/pathfinding.ts
Normal file
30
ems-frontend/ems-monitoring-system/src/api/pathfinding.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import apiClient from './index';
|
||||
|
||||
/**
|
||||
* Represents a point with x and y coordinates.
|
||||
* Matches the backend Point DTO.
|
||||
*/
|
||||
export interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the request payload for finding a path.
|
||||
* Matches the backend PathfindingRequest DTO.
|
||||
*/
|
||||
export interface PathfindingRequest {
|
||||
startX: number;
|
||||
startY: number;
|
||||
endX: number;
|
||||
endY: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the backend API to find a path between two points.
|
||||
* @param request The pathfinding request containing start and end coordinates.
|
||||
* @returns A promise that resolves to a list of points representing the path.
|
||||
*/
|
||||
export const findPath = (request: PathfindingRequest): Promise<Point[]> => {
|
||||
return apiClient.post('/pathfinding/find', request);
|
||||
};
|
||||
Reference in New Issue
Block a user