Skip to content

Commit 2d4a643

Browse files
authored
Update index.html
1 parent 6ae4fe8 commit 2d4a643

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

index.html

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -71,42 +71,11 @@ <h3 class="text-lg font-semibold">Your Short URL</h3>
7171

7272
<script>
7373
const form = document.getElementById("shortenForm");
74-
const resultDiv = document.getElementById("result");
75-
const shortUrlElement = document.getElementById("shortUrl");
76-
const copyBtn = document.getElementById("copyBtn");
7774

7875
form.addEventListener("submit", async (e) => {
7976
e.preventDefault();
8077

81-
const originalUrl = document.getElementById("originalUrl").value;
82-
const customAlias = document.getElementById("customAlias").value;
83-
84-
const response = await fetch("/api/shorten", {
85-
method: "POST",
86-
headers: {
87-
"Content-Type": "application/json",
88-
},
89-
body: JSON.stringify({
90-
originalUrl,
91-
customAlias,
92-
}),
93-
});
94-
95-
const data = await response.json();
96-
97-
if (response.ok) {
98-
resultDiv.classList.remove("hidden");
99-
shortUrlElement.textContent = data.shortUrl;
100-
} else {
101-
alert(data.error || "Something went wrong!");
102-
}
103-
});
104-
105-
copyBtn.addEventListener("click", () => {
106-
const url = shortUrlElement.textContent;
107-
navigator.clipboard.writeText(url).then(() => {
108-
alert("URL copied to clipboard!");
109-
});
78+
alert('received URL(This is a Demo, the app would now give you the shortened Url below the form with a copy button)');
11079
});
11180
</script>
11281
</body>

0 commit comments

Comments
 (0)