feat(gameplay): Adding a military power section to exploit population numbers and steal ennemy tiles
This commit is contained in:
@@ -111,3 +111,28 @@ export async function apiFetchActivePlayers() {
|
||||
if (!res.ok) throw new Error("active_players_fetch_failed");
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function apiFetchMilitaryDeductions() {
|
||||
const res = await fetch("/api/military-deductions");
|
||||
if (!res.ok) throw new Error("military_deductions_fetch_failed");
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function apiMilitaryAttack(seed, x, y) {
|
||||
const token = localStorage.getItem("authToken");
|
||||
const res = await fetch("/api/military/attack", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
body: JSON.stringify({ seed, x, y }),
|
||||
});
|
||||
return res; // caller inspects status
|
||||
}
|
||||
|
||||
export async function apiFetchCellAttackCount(x, y) {
|
||||
const res = await fetch(`/api/cell/attacks?x=${x}&y=${y}`);
|
||||
if (!res.ok) throw new Error("cell_attacks_fetch_failed");
|
||||
return res.json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user