moar refactoring
This commit is contained in:
parent
01d817a206
commit
ccfe6c60cd
|
@ -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!");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue