}
await env.links.put(shortUrl, fullUrl);
- return new Response(`Successfully created short URL: https://alu.bz/${shortUrl}`, { headers: { 'Content-Type': 'text/plain; charset=UTF-8' } });
+ return new Response(shortUrl, { headers: { 'Content-Type': 'text/plain; charset=UTF-8' } });
}
if (response.ok) {
statusOutput.classList.add('success');
+ const generatedUrl = await response.text();
+ statusOutput.innerHTML = `Successfully created short URL: <a href="${location.origin}/${generatedUrl}">${location.origin}/${generatedUrl}</a>`;
}
else {
statusOutput.classList.add('failure');
+ statusOutput.textContent = await response.text();
}
- statusOutput.textContent = await response.text();
}
if (window.ethereum !== undefined) {