Remove another hand written API model.

There are still two more of these that don't show up in openapi.json
because they don't show up in HTTP routes (only in the websocket):

* GameUpdateEvents
* FrozenCombat

I'm not sure if there's a way to forcibly include those in the
openapi.json, if I should add a no-op API to force it to happen, or if I
should just ignore it. For now I'm going with option 3.
This commit is contained in:
Dan Albert 2022-03-06 23:44:15 -08:00
parent 4b4336391a
commit d7e62d0b0b
5 changed files with 5 additions and 26 deletions

View File

@ -1,4 +1,4 @@
import Game from "./game"; import { Game } from "./liberationApi";
import { createAction } from "@reduxjs/toolkit"; import { createAction } from "@reduxjs/toolkit";
export const gameLoaded = createAction<Game>("game/loaded"); export const gameLoaded = createAction<Game>("game/loaded");

View File

@ -1,21 +0,0 @@
import {
ControlPoint,
Flight,
FrontLine,
NavMeshes,
SupplyRoute,
Tgo,
ThreatZoneContainer,
} from "./liberationApi";
import { LatLngLiteral } from "leaflet";
export default interface Game {
control_points: ControlPoint[];
tgos: Tgo[];
supply_routes: SupplyRoute[];
front_lines: FrontLine[];
flights: Flight[];
threat_zones: ThreatZoneContainer;
navmeshes: NavMeshes;
map_center: LatLngLiteral | null;
}

View File

@ -1,7 +1,7 @@
import { AppDispatch } from "../app/store"; import { AppDispatch } from "../app/store";
import { gameLoaded, gameUnloaded } from "./actions"; import { gameLoaded, gameUnloaded } from "./actions";
import backend from "./backend"; import backend from "./backend";
import Game from "./game"; import { Game } from "./liberationApi";
export default function reloadGameState( export default function reloadGameState(
dispatch: AppDispatch, dispatch: AppDispatch,
@ -17,7 +17,7 @@ export default function reloadGameState(
} }
const game = response.data as Game; const game = response.data as Game;
if (ignoreRecenter) { if (ignoreRecenter) {
game.map_center = null; game.map_center = undefined;
} }
dispatch(gameLoaded(game)); dispatch(gameLoaded(game));
}); });

View File

@ -443,7 +443,7 @@ export type Game = {
flights: Flight[]; flights: Flight[];
threat_zones: ThreatZoneContainer; threat_zones: ThreatZoneContainer;
navmeshes: NavMeshes; navmeshes: NavMeshes;
map_center: LatLng; map_center?: LatLng;
}; };
export type MapZones = { export type MapZones = {
inclusion: LatLng[][]; inclusion: LatLng[][];

View File

@ -25,7 +25,7 @@ class GameJs(BaseModel):
flights: list[FlightJs] flights: list[FlightJs]
threat_zones: ThreatZoneContainerJs threat_zones: ThreatZoneContainerJs
navmeshes: NavMeshesJs navmeshes: NavMeshesJs
map_center: LeafletPoint map_center: LeafletPoint | None
class Config: class Config:
title = "Game" title = "Game"