can now use custom path
This commit is contained in:
parent
eb9d276ac4
commit
3f4c835bd1
3 changed files with 78 additions and 17 deletions
|
@ -24,6 +24,16 @@ async function submitForm(e, form) {
|
|||
document.getElementById("shortUrl").innerHTML = response.shortUrl
|
||||
document.getElementById("shortUrl").href = response.shortUrl
|
||||
document.getElementById("longUrl").innerHTML = "Long Url: " + response.longUrl
|
||||
if (response.edit) {
|
||||
console.log("Already have this path, editing.")
|
||||
}
|
||||
if (response.old) {
|
||||
document.getElementById("edit").style.visibility = "visible"
|
||||
document.getElementById("oldLongUrl").innerHTML = response.old.longUrl
|
||||
document.getElementById("oldLongUrl").href = response.old.longUrl
|
||||
document.getElementById("oldShortUrl").innerHTML = response.old.shortUrl
|
||||
document.getElementById("oldShortUrl").href = response.old.shortUrl
|
||||
}
|
||||
}
|
||||
else
|
||||
alert(`An error occured.`);
|
||||
|
@ -44,8 +54,11 @@ function buildJsonFormData(form) {
|
|||
}
|
||||
return jsonFormData;
|
||||
}
|
||||
|
||||
/*--/Functions--*/
|
||||
|
||||
document.getElementById("edit").style.visibility = 'hidden'
|
||||
|
||||
/*--Event Listeners--*/
|
||||
const sampleForm = document.querySelector("#form");
|
||||
if(sampleForm) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue