--- import ItemCard from '../../components/ItemCard.astro'; import LoggedIn from '../../layouts/LoggedIn.astro'; import { Planet } from '../../lib/classes/managers/PlanetManager'; import SystemManager from '../../lib/classes/managers/SystemManager'; import { getAllShips } from '../../lib/db/ships'; import { getName, getObj } from '../../lib/utils/langDriver'; const { token, lang } = Astro.locals; const active: SystemManager | Planet = Astro.locals.active; const ships = await getAllShips(); if(Astro.request.method === "POST") { const body = await Astro.request.formData(); const id = body.get("id") as string; const amount = parseInt(body.get("amount") as string ?? "1"); const request = await (await fetch(Astro.url.origin + '/api/ships/addShip', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token }, body: JSON.stringify({ planet: active instanceof SystemManager ? active.data._id : active._id, ship: id, amount }) })).json(); console.log(request); } const modalSet: { [key: string]: { resources: Array, research: Array, buildings: Array } } = {}; for(const ship of ships) { modalSet[ship.id] = { resources: ship.requirements.resources, research: ship.requirements.research, buildings: ship.requirements.buildings, // energy: building.energy }; } const planetId = active instanceof SystemManager ? active.data._id : active._id; ---

{getName(lang, 'general', 'required-resources')}

{getName(lang, 'general', 'none')}

{getName(lang, 'general', 'required-buildings')}

{getName(lang, 'general', 'none')}

{getName(lang, 'general', 'required-research')}

{getName(lang, 'general', 'none')}
{ships.map(ship => <> )}