feat: start of all tanks

This commit is contained in:
TrèsAbhi committed 2025-12-26 14:59:09 -06:00
1 parent 53d05e73a6
commit fcfc97b964
14 files changed
+174 -58

No files matched your search

+12 -5
View File
@@ -1,12 +1,19 @@
import { fetchPB } from "@blitzkit/core";
import { Tank } from "../../protos/tank";
import { TankList } from "../../protos/tank_list";
import { Tanks } from "../../protos/tanks";
import { AbstractAPI } from "./abstract";
export class ClientAPI extends AbstractAPI {
async tank(id: string) {
const response = await fetch(`/api/tanks/${id}.pb`);
const buffer = await response.arrayBuffer();
const array = new Uint8Array(buffer);
tanks() {
return fetchPB("/api/tanks.pb", Tanks);
}
return Tank.decode(array);
tankList() {
return fetchPB("/api/tanks/list.pb", TankList);
}
tank(id: string) {
return fetchPB(`/api/tanks/${id}.pb`, Tank);
}
}