mirror of
https://github.com/SinTan1729/chhoto-url
synced 2024-12-26 23:58:35 -06:00
Add error box in async
This commit is contained in:
parent
3d239c189c
commit
4e18a6aeb9
1 changed files with 1 additions and 2 deletions
|
@ -20,7 +20,7 @@ const displayData = (data) => {
|
||||||
.forEach(tr => table.appendChild(tr));
|
.forEach(tr => table.appendChild(tr));
|
||||||
};
|
};
|
||||||
|
|
||||||
const addErrBox = () => {
|
const addErrBox = async () => {
|
||||||
const controls = document.querySelector(".pure-controls");
|
const controls = document.querySelector(".pure-controls");
|
||||||
const errBox = document.createElement("p");
|
const errBox = document.createElement("p");
|
||||||
errBox.setAttribute("id", "errBox");
|
errBox.setAttribute("id", "errBox");
|
||||||
|
@ -82,7 +82,6 @@ const submitForm = () => {
|
||||||
body: `${longUrl.value};${shortUrl.value}`
|
body: `${longUrl.value};${shortUrl.value}`
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("0");
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
if (document.getElementById("errBox") == null) {
|
if (document.getElementById("errBox") == null) {
|
||||||
addErrBox();
|
addErrBox();
|
||||||
|
|
Loading…
Reference in a new issue