desktop修正
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
const API_BASE = "http://localhost:18080";
|
||||
const API_BASE = "http://127.0.0.1:18080";
|
||||
|
||||
async function apiGet(path) {
|
||||
const res = await fetch(`${API_BASE}${path}`);
|
||||
async function apiGet(path, params = {}) {
|
||||
const query = new URLSearchParams(params).toString();
|
||||
const url = `${API_BASE}${path}?${query}`;
|
||||
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(text || "APIエラー");
|
||||
const data = await res.json();
|
||||
throw new Error(data.detail || "APIエラー");
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user