moar refactoring
This commit is contained in:
parent
01d817a206
commit
ccfe6c60cd
|
@ -29,7 +29,7 @@ export async function setupRequestPage(element: HTMLElement) {
|
||||||
<button
|
<button
|
||||||
aria-label="Copy to Clipboard"
|
aria-label="Copy to Clipboard"
|
||||||
.id=${COPY_BUTTON_ID}
|
.id=${COPY_BUTTON_ID}
|
||||||
@click=${copyToClipboard}
|
@click=${(event: Event) => copyToClipboard(event, url.toString())}
|
||||||
>
|
>
|
||||||
Copy to Clipboard
|
Copy to Clipboard
|
||||||
</button>
|
</button>
|
||||||
|
@ -39,10 +39,9 @@ export async function setupRequestPage(element: HTMLElement) {
|
||||||
render(element, template);
|
render(element, template);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copyToClipboard(event: Event) {
|
async function copyToClipboard(event: Event, url: string) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const input = document.getElementById(URL_INPUT_ID) as HTMLInputElement;
|
await navigator.clipboard.writeText(url);
|
||||||
await navigator.clipboard.writeText(input.value);
|
|
||||||
alert("Copied to clipboard!");
|
alert("Copied to clipboard!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue