diff --git a/src/api/marneApi.tsx b/src/api/marneApi.tsx index 83e13c9..7a82bfe 100644 --- a/src/api/marneApi.tsx +++ b/src/api/marneApi.tsx @@ -54,16 +54,18 @@ export interface DetailedServerReturn { country: string; mapName: string; gameMode: string; + map: string; + mode: string; maxPlayers: number; needSameMods: boolean; allowMoreMods: boolean; + statsSystem: number; tickRate: number; password: boolean; settings: ServerSettings[]; - rotation: RotationReturn[]; modList: ModListReturn[] | ""; - currentPlayers: number; playerList: PlayerReturn[] | ""; + currentPlayers: number; } interface ServerSearchInfo { @@ -321,7 +323,7 @@ export class ApiProvider extends JsonClient { } const r = await fetch(`https://marne.io/api/srvlst/${gameId}`); - const result = await r.json(); + const result: DetailedServerReturn = await r.json(); const internalMapName: string = result.mapName.split("/").slice(-1)[0]; return { apiUrl: `https://marne.io/api/srvlst/${gameId}`, @@ -341,7 +343,7 @@ export class ApiProvider extends JsonClient { smallmode: smallmodes[result.gameMode], settings: result.settings, description: result.description, - rotation: result.rotation.map( + rotation: result?.rotation?.map( (current: RotationReturn, index: number) => { const internal = to_internal[current.map.toLowerCase()]; return { diff --git a/src/components/routes/Servers/Detailed/Servers.tsx b/src/components/routes/Servers/Detailed/Servers.tsx index 9607f1e..6d16c5d 100644 --- a/src/components/routes/Servers/Detailed/Servers.tsx +++ b/src/components/routes/Servers/Detailed/Servers.tsx @@ -66,6 +66,7 @@ function Servers(): React.ReactElement { document.title = `${t("siteFullName")} ${t("pageTitle.servers")} | ${ gameId || t("notApplicable") } | ${stats?.prefix || t("loading")}`; + console.log(stats); return (