// static/js/graph/wizard/api.js export async function setTarget(ip) { const r = await fetch('/api/host/target', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ ip }) }); const j = await r.json(); if (!r.ok || !j.ok) throw new Error(j.error || 'Failed to set target IP'); return j; } export async function getTarget() { const r = await fetch('/api/host/target'); // returns { ip: "x.x.x.x" } or { ip: null } return r.ok ? r.json() : { ip: null }; } export async function bootstrapAccess() { const r = await fetch('/api/host/bootstrap_access', { method: 'POST' }); const j = await r.json(); if (!r.ok || !j.ok) throw new Error(j.error || 'Failed to bootstrap access'); return j; } // static/js/wizard/api.js export async function renderAnsible(payload) { const r = await fetch('/api/ansible/render', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(payload) }); const j = await r.json().catch(() => ({})); if (!r.ok || !j.ok) { const msg = j.error || `Render failed (HTTP ${r.status})`; throw new Error(msg); } return j; // { ok: true, staging: "ansible_workspace/staging" } }