refacto: Changing gameplay so teams don't know what the other team got + both teams can now chart the same cell without knowing + planet capture gameplay implemented
This commit is contained in:
@@ -10,15 +10,11 @@ export async function apiFetchConfig(team) {
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function apiFetchScores() {
|
||||
const res = await fetch("/api/scores");
|
||||
if (!res.ok) throw new Error("scores_fetch_failed");
|
||||
return res.json();
|
||||
}
|
||||
|
||||
/** Returns the raw Response so the caller can inspect status codes (410, etc.). */
|
||||
export async function apiFetchGrid(seed) {
|
||||
return fetch(`/api/grid/${encodeURIComponent(seed)}`);
|
||||
const token = localStorage.getItem("authToken");
|
||||
const headers = token ? { Authorization: `Bearer ${token}` } : {};
|
||||
return fetch(`/api/grid/${encodeURIComponent(seed)}`, { headers });
|
||||
}
|
||||
|
||||
/** Returns the raw Response so the caller can inspect status codes (409, 410, etc.). */
|
||||
@@ -136,3 +132,16 @@ export async function apiFetchCellAttackCount(x, y) {
|
||||
if (!res.ok) throw new Error("cell_attacks_fetch_failed");
|
||||
return res.json();
|
||||
}
|
||||
|
||||
/** Returns the raw Response so the caller can inspect status codes. */
|
||||
export async function apiCaptureCell(seed, x, y) {
|
||||
const token = localStorage.getItem("authToken");
|
||||
return fetch("/api/cell/capture", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
body: JSON.stringify({ seed, x, y }),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user