moar refactoring

This commit is contained in:
Silas 2024-02-01 21:38:33 -05:00
parent 01d817a206
commit ccfe6c60cd
Signed by: silentsilas
GPG Key ID: 4199EFB7DAA34349
1 changed files with 3 additions and 4 deletions

View File

@ -29,7 +29,7 @@ export async function setupRequestPage(element: HTMLElement) {
<button
aria-label="Copy to Clipboard"
.id=${COPY_BUTTON_ID}
@click=${copyToClipboard}
@click=${(event: Event) => copyToClipboard(event, url.toString())}
>
Copy to Clipboard
</button>
@ -39,10 +39,9 @@ export async function setupRequestPage(element: HTMLElement) {
render(element, template);
}
async function copyToClipboard(event: Event) {
async function copyToClipboard(event: Event, url: string) {
event.preventDefault();
const input = document.getElementById(URL_INPUT_ID) as HTMLInputElement;
await navigator.clipboard.writeText(input.value);
await navigator.clipboard.writeText(url);
alert("Copied to clipboard!");
}