mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-05 15:52:55 +01:00
feat: some implementation for client unmounted mode
This commit is contained in:
1 parent
980fd6e50e
commit
ba4e6dfd68
7 files changed
+29
-26
No files matched your search
@@ -1,14 +1,20 @@
|
||||
import type { APIContext } from "astro";
|
||||
import { api } from "../../../core/api/dynamic";
|
||||
import { game } from "../../../core/game/game";
|
||||
import {
|
||||
clientUnmountedResponse,
|
||||
notFoundResponse,
|
||||
} from "../../../core/api/responses";
|
||||
import { clientUnmounted, game } from "../../../core/game/game";
|
||||
|
||||
export { getStaticPaths } from "./[id].json";
|
||||
|
||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||
const tank = await api.tank(params.id);
|
||||
const image = game.tankBigIcon(params.id, tank.tank!.visual_data);
|
||||
if (clientUnmounted) return clientUnmountedResponse;
|
||||
|
||||
if (image.length === 0) return new Response(null, { status: 404 });
|
||||
const tank = await api.tank(params.id);
|
||||
const image = game!.tankBigIcon(params.id, tank.tank!.visual_data);
|
||||
|
||||
if (image.length === 0) return notFoundResponse;
|
||||
|
||||
return new Response(new Uint8Array(image));
|
||||
}
|
||||
Reference in new issue
Block a user