diff options
| author | Adam Soltys <[email protected]> | 2026-03-01 14:30:39 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-01 14:30:39 -0800 |
| commit | f3d2029a61138d69437c1815a41fa6db3fd6198a (patch) | |
| tree | 149ed8baa69561d4d82436388049189fa411ea23 /src/routes | |
| parent | 0eb128fdd59cd550beda23549a47df75442d997f (diff) | |
| download | coinos-ui-f3d2029a61138d69437c1815a41fa6db3fd6198a.tar.gz coinos-ui-f3d2029a61138d69437c1815a41fa6db3fd6198a.zip | |
dm test
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/(app)/dm/+page.svelte | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/routes/(app)/dm/+page.svelte b/src/routes/(app)/dm/+page.svelte index 1f1df536..b7026f94 100644 --- a/src/routes/(app)/dm/+page.svelte +++ b/src/routes/(app)/dm/+page.svelte @@ -283,11 +283,19 @@ return expiration <= Date.now() / 1000 + 2 * 86400; }; + let sendError = $state(""); + const sendMessage = async (message: string) => { - const expiry = expiryEnabled ? expiryDays : undefined; - await libnip17.send(message, user, selectedChat, expiry); - text = ""; - updateEvents(); + sendError = ""; + try { + const expiry = expiryEnabled ? expiryDays : undefined; + await libnip17.send(message, user, selectedChat, expiry); + text = ""; + updateEvents(); + } catch (e: any) { + console.error("Failed to send message:", e); + sendError = $t("dm.sendFailed"); + } }; (() => libnip17.getPreferredRelays(data.user.pubkey).then((relays) => { @@ -459,6 +467,9 @@ : $t("dm.relaysNotFound").replace("[R]", name(selectedChat))} onclick={async () => sendMessage(text)} /> + {#if sendError} + <p class="warning"><em>{sendError}</em></p> + {/if} {/if} {#if !(muted && muted.has(selectedChat.pubkey))} |
