mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2025-10-09 17:07:20 +08:00
Add webui
This commit is contained in:
18
webui/src/Request.jsx
Normal file
18
webui/src/Request.jsx
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
const serverUrl = "";
|
||||
|
||||
async function api(url, body) {
|
||||
try {
|
||||
let options = body ? {method: "POST", body: JSON.stringify(body)} : {}
|
||||
const resp = await fetch(serverUrl + url, options);
|
||||
const text = await resp.text();
|
||||
return JSON.parse(text);
|
||||
} catch(e) {
|
||||
return {
|
||||
result: "ERR",
|
||||
message: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default api;
|
Reference in New Issue
Block a user