diff --git a/src/api/marneApi.tsx b/src/api/marneApi.tsx index 82e2884..bb853b1 100644 --- a/src/api/marneApi.tsx +++ b/src/api/marneApi.tsx @@ -273,38 +273,43 @@ export class ApiProvider extends JsonClient { this.serverCacheAge = Date.now(); } const country = await getCurrentCountry(); - const servers = this.serverCache.servers - .map((server) => { - const internalMapName: string = server?.mapName - ?.split("/") - .slice(-1)[0]; - return { - gameId: server?.id.toString(), - prefix: server?.name, - currentMap: maps[internalMapName], - currentMapImage: map_image[internalMapName], - url: map_image[internalMapName], - inQue: 0, - mode: modes[server?.gameMode], - official: false, - ownerId: 0, - region: server?.region, - country: getName(server?.country, country), - platform: "pc", - playerAmount: server?.currentPlayers, - maxPlayerAmount: server?.maxPlayers, - serverInfo: "", - smallMode: smallmodes[server?.gameMode], - }; - }) - .filter((server) => { - return ( - server.prefix.toLowerCase().includes(searchTerm.toLowerCase()) && - (regions.includes(server.region.toLowerCase()) || - regions.includes("all")) - ); - }) - .slice(0, !Number.isNaN(Number(limit)) ? Number(limit) : 10); + const servers = + this.serverCache.servers == undefined + ? [] + : this.serverCache.servers + .map((server) => { + const internalMapName: string = server?.mapName + ?.split("/") + .slice(-1)[0]; + return { + gameId: server?.id.toString(), + prefix: server?.name, + currentMap: maps[internalMapName], + currentMapImage: map_image[internalMapName], + url: map_image[internalMapName], + inQue: 0, + mode: modes[server?.gameMode], + official: false, + ownerId: 0, + region: server?.region, + country: getName(server?.country, country), + platform: "pc", + playerAmount: server?.currentPlayers, + maxPlayerAmount: server?.maxPlayers, + serverInfo: "", + smallMode: smallmodes[server?.gameMode], + }; + }) + .filter((server) => { + return ( + server.prefix + .toLowerCase() + .includes(searchTerm.toLowerCase()) && + (regions.includes(server.region.toLowerCase()) || + regions.includes("all")) + ); + }) + .slice(0, !Number.isNaN(Number(limit)) ? Number(limit) : 10); return { cache: false, servers, diff --git a/src/components/routes/Servers/Search/Results.tsx b/src/components/routes/Servers/Search/Results.tsx index 02ec9cd..f8317ea 100644 --- a/src/components/routes/Servers/Search/Results.tsx +++ b/src/components/routes/Servers/Search/Results.tsx @@ -125,7 +125,6 @@ export function Results(props: Views): React.ReactElement { if (queue !== undefined && queue !== 0 && queue !== null) { queueString = `[${queue}]`; } - // console.log(`${t(`regions.${key.region.toLowerCase()}`)}`); let region: string = undefined; if (props.game === "bf2042") { if (Object.keys(regionToTranslation).includes(key.region)) {