11 lines
247 B
JavaScript
11 lines
247 B
JavaScript
const API_BASE = "http://localhost:18080";
|
|
|
|
async function apiGet(path) {
|
|
const res = await fetch(`${API_BASE}${path}`);
|
|
if (!res.ok) {
|
|
const text = await res.text();
|
|
throw new Error(text || "APIエラー");
|
|
}
|
|
return res.json();
|
|
}
|