Fix index.html and api
This commit is contained in:
parent
5fa74043bc
commit
d7edb08c1e
@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script src="%PUBLIC_URL%/env.js"></script>
|
||||
<script src="/env.js"></script>
|
||||
<title>Vite + React</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
const API_BASE = import.meta.env.VITE_API_BASE;
|
||||
const API_BASE = window?.ENV?.API_BASE || "";
|
||||
|
||||
export async function fetchDiagram() {
|
||||
const res = await fetch(`${API_BASE}/diagram/fetch`);
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to fetch diagram: ${res.status}`);
|
||||
}
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
@ -11,11 +14,18 @@ export async function saveDiagram(data) {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to save diagram: ${res.status}`);
|
||||
}
|
||||
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
export async function fetchIconCategories() {
|
||||
const res = await fetch(`${API_BASE}/icons`);
|
||||
if (!res.ok) {
|
||||
throw new Error(`Failed to fetch icons: ${res.status}`);
|
||||
}
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user