Skip to content

Commit

Permalink
implement fix for new changes in marne
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Nov 17, 2023
1 parent 083453a commit 225636d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/api/marneApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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}`,
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/components/routes/Servers/Detailed/Servers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div>
<Container>
Expand Down

0 comments on commit 225636d

Please sign in to comment.