diff --git a/packages/website-ue/public/api/unmounted/tank.png b/packages/website-ue/public/api/unmounted/tank.png new file mode 100644 index 000000000..14f41c849 Binary files /dev/null and b/packages/website-ue/public/api/unmounted/tank.png differ diff --git a/packages/website-ue/src/components/TankCard/index.tsx b/packages/website-ue/src/components/TankCard/index.tsx index 1aadb4ae0..26f20e670 100644 --- a/packages/website-ue/src/components/TankCard/index.tsx +++ b/packages/website-ue/src/components/TankCard/index.tsx @@ -1,4 +1,5 @@ import { api } from "../../core/api/dynamic"; +import { clientUnmounted } from "../../core/game/game"; import { useAwait } from "../../hooks/useAwait"; import { useGameStrings } from "../../hooks/useGameStrings"; import { useLocale } from "../../hooks/useLocale"; @@ -42,7 +43,9 @@ export function TankCard(props: PropsWithSkeleton) {
)} diff --git a/packages/website-ue/src/pages/api/nations/[id]/card.webp.ts b/packages/website-ue/src/pages/api/nations/[id]/card.webp.ts index 447484749..de7941946 100644 --- a/packages/website-ue/src/pages/api/nations/[id]/card.webp.ts +++ b/packages/website-ue/src/pages/api/nations/[id]/card.webp.ts @@ -1,6 +1,7 @@ import { Nation } from "@protos/game/proto/legacy/blitz_static_tank_component"; import type { APIContext, GetStaticPaths } from "astro"; -import { game } from "../../../../core/game/game"; +import { clientUnmountedResponse } from "../../../../core/api/responses"; +import { clientUnmounted, game } from "../../../../core/game/game"; export const getStaticPaths = (async () => { return Object.values(Nation) @@ -12,9 +13,11 @@ export const getStaticPaths = (async () => { * Even Noah can't save these animals. */ export async function GET({ params }: APIContext) { + if (clientUnmounted) return clientUnmountedResponse; + const enumName = Nation[Number(params.id)]; const nationName = enumName.replace("NATION_", "").toLowerCase(); - const flag = game.flag(nationName); + const flag = game!.flag(nationName); return new Response(new Uint8Array(flag)); }