Skip to content

Commit 6d5285f

Browse files
committed
ui coloring complete
1 parent 7c3f34e commit 6d5285f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

example/client/component/api-fetch.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ class APIFetch extends HTMLElement {
4848
}
4949
param = {...param, ...d};
5050
}
51-
this.#rcntr.innerHTML = JSON.stringify(await this.#api.fetchRaw(fname, param), null, 4);
51+
let resp = await this.#api.fetchRaw(fname, param);
52+
this.#rcntr.innerHTML = JSON.stringify(resp, null, 4);
53+
54+
this.#root.querySelector('#resp_cntr').style.background = (resp.status === 0) ? '#4caf50' : '#f44336';
5255

5356
let paramjson = JSON.stringify(param);
5457
let hasparam = Object.entries(param).length === 0;
@@ -144,6 +147,7 @@ pre {
144147
#out_cntr > section {
145148
box-shadow: 0 0 0.5em black;
146149
padding: 0.5em 1em;
150+
background: #e0f2f1;
147151
}
148152
</style><div id="cntr">
149153
<header>API Function: <button id="fetch">Execute 🗘</button></header>

0 commit comments

Comments
 (0)