Draw commit boundaries in the new map.

https://github.com/dcs-liberation/dcs_liberation/issues/2039
This commit is contained in:
Dan Albert
2022-03-05 02:23:14 -08:00
parent 35df036eb8
commit b4edd5d841
4 changed files with 52 additions and 1 deletions

16
client/src/api/api.ts Normal file
View File

@@ -0,0 +1,16 @@
import { HTTP_URL } from "./backend";
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
import { LatLng } from "leaflet";
// TODO: We should be auto-generating this from FastAPI's openapi.json.
export const apiSlice = createApi({
reducerPath: "api",
baseQuery: fetchBaseQuery({ baseUrl: HTTP_URL }),
endpoints: (builder) => ({
getCommitBoundaryForFlight: builder.query<LatLng[], string>({
query: (flightId) => `flights/${flightId}/commit-boundary`,
}),
}),
});
export const { useGetCommitBoundaryForFlightQuery } = apiSlice;

View File

@@ -1,7 +1,9 @@
import axios from "axios";
export const HTTP_URL = "http://[::1]:5000/";
export const backend = axios.create({
baseURL: "http://[::1]:5000/",
baseURL: HTTP_URL,
});
export const WEBSOCKET_URL = "ws://[::1]:5000/eventstream";