mirror of
https://github.com/SinTan1729/chhoto-url
synced 2024-12-26 23:58:35 -06:00
Stop creating multiple error dialogs
This commit is contained in:
parent
fab2924250
commit
74e5b5d1c7
1 changed files with 8 additions and 6 deletions
|
@ -74,12 +74,14 @@ const submitForm = () => {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
controls = document.querySelector(".pure-controls");
|
if (document.getElementById("errBox") == null) {
|
||||||
errBox = document.createElement("p");
|
controls = document.querySelector(".pure-controls");
|
||||||
errBox.setAttribute("id", "errBox");
|
errBox = document.createElement("p");
|
||||||
errBox.setAttribute("style", "color:red");
|
errBox.setAttribute("id", "errBox");
|
||||||
errBox.innerHTML = "Short URL not valid or already in use";
|
errBox.setAttribute("style", "color:red");
|
||||||
controls.appendChild(errBox);
|
errBox.innerHTML = "Short URL not valid or already in use!";
|
||||||
|
controls.appendChild(errBox);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.getElementById("errBox")?.remove();
|
document.getElementById("errBox")?.remove();
|
||||||
|
|
Loading…
Reference in a new issue