Added error alert logic
This commit is contained in:
parent
e308b7b448
commit
c48527ad0c
14
main.js
14
main.js
|
@ -55,18 +55,14 @@ function createUrl() {
|
|||
|
||||
}
|
||||
|
||||
document.getElementById("error_dismiss").onclick = () =>{
|
||||
document.getElementById("error_container").classList.add("hidden");
|
||||
};
|
||||
function handleError(res) {
|
||||
if (res.status == 400) {
|
||||
res.text().then((body)=>{
|
||||
switch (body) {
|
||||
case "Shortcode already exists, please choose another code":
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
document.getElementById("error_text").innerText=body;
|
||||
document.getElementById("error_container").classList.remove("hidden");
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue