update console messages

This commit is contained in:
agatha 2024-04-13 22:29:15 -04:00
parent 9afc7b1298
commit e5b701aa55

View File

@ -31,13 +31,14 @@ function unshortenUrl(linkUrl) {
fetch("http://localhost:8000/?url=" + linkUrl) fetch("http://localhost:8000/?url=" + linkUrl)
.then(res => { .then(res => {
if (!res.ok) { if (!res.ok) {
console.log("error fetching result"); console.log("Couldn't unshorten URL: " + res.statusText);
} }
return res.json(); return res.json();
}) })
.then(unshortenedUrl => { .then(unshortenedUrl => {
console.log("unshortened: " + unshortenedUrl) console.log("unshortened: " + unshortenedUrl)
navigator.clipboard.writeText(unshortenedUrl) navigator.clipboard.writeText(unshortenedUrl)
.catch(err => console.error("couldn't copy to clipboard", err)); .catch(err => console.error("Couldn't copy to clipboard: ", err));
}); })
.catch(err => {console.error("Couldn't contact server:", err)});
} }