Spaces:
Building
Building
Delete static/js/common.js
Browse files- static/js/common.js +0 -31
static/js/common.js
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
const apiBase = 'https://ucsturkey-flare.hf.space';
|
2 |
-
|
3 |
-
function apiPost(path, body) {
|
4 |
-
return fetch(`${apiBase}${path}`, {
|
5 |
-
method: 'POST',
|
6 |
-
headers: { 'Content-Type': 'application/json' },
|
7 |
-
body: JSON.stringify(body)
|
8 |
-
}).then(res => {
|
9 |
-
if (!res.ok) {
|
10 |
-
return res.json().then(err => { throw err; });
|
11 |
-
}
|
12 |
-
return res.json();
|
13 |
-
});
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
-
function apiGet(path) {
|
18 |
-
return fetch(`${apiBase}${path}`)
|
19 |
-
.then(res => res.json());
|
20 |
-
}
|
21 |
-
|
22 |
-
function showResult(id, data) {
|
23 |
-
const el = document.getElementById(id);
|
24 |
-
if (data.detail) {
|
25 |
-
el.innerText = data.detail;
|
26 |
-
el.classList.add('text-danger');
|
27 |
-
} else {
|
28 |
-
el.innerText = data.message || JSON.stringify(data, null, 2);
|
29 |
-
el.classList.remove('text-danger');
|
30 |
-
}
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|