mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Properly await promises
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
icon = "clipboard-small";
|
||||
}, 800);
|
||||
|
||||
function copyToClipboard(clipboard: string) {
|
||||
void toClipboard(clipboard);
|
||||
async function copyToClipboard(clipboard: string): Promise<void> {
|
||||
await toClipboard(clipboard);
|
||||
icon = "checkmark-small";
|
||||
restoreIcon();
|
||||
}
|
||||
@@ -181,8 +181,8 @@
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<span
|
||||
class="cmd"
|
||||
on:click={() => {
|
||||
copyToClipboard(command);
|
||||
on:click={async () => {
|
||||
await copyToClipboard(command);
|
||||
}}>
|
||||
{command}
|
||||
<div class="cmd-clipboard">
|
||||
@@ -199,9 +199,9 @@
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="id-container"
|
||||
on:click={() => {
|
||||
on:click={async () => {
|
||||
if ($sessionStore) {
|
||||
copyToClipboard($sessionStore.publicKey);
|
||||
await copyToClipboard($sessionStore.publicKey);
|
||||
}
|
||||
}}>
|
||||
<div class="id">
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
icon = small ? "clipboard-small" : "clipboard";
|
||||
}, 800);
|
||||
|
||||
const copy = () => {
|
||||
void toClipboard(text);
|
||||
async function copy() {
|
||||
await toClipboard(text);
|
||||
dispatch("copied");
|
||||
icon = small ? "checkmark-small" : "checkmark";
|
||||
restoreIcon();
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { base } from "@app/lib/router";
|
||||
import { config } from "@app/lib/config";
|
||||
|
||||
export async function toClipboard(text: string): Promise<void> {
|
||||
return navigator.clipboard.writeText(text);
|
||||
await navigator.clipboard.writeText(text);
|
||||
}
|
||||
|
||||
export function getRawBasePath(
|
||||
|
||||
@@ -257,8 +257,8 @@
|
||||
{#if $sessionStore}
|
||||
<Textarea
|
||||
resizable
|
||||
on:submit={() => {
|
||||
void createComment(commentBody);
|
||||
on:submit={async () => {
|
||||
await createComment(commentBody);
|
||||
commentBody = "";
|
||||
}}
|
||||
bind:value={commentBody}
|
||||
@@ -273,8 +273,8 @@
|
||||
variant="secondary"
|
||||
size="small"
|
||||
disabled={!commentBody}
|
||||
on:click={() => {
|
||||
void createComment(commentBody);
|
||||
on:click={async () => {
|
||||
await createComment(commentBody);
|
||||
commentBody = "";
|
||||
}}>
|
||||
Comment
|
||||
|
||||
Reference in New Issue
Block a user