aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-01 14:30:39 -0800
committerAdam Soltys <[email protected]>2026-03-01 14:30:39 -0800
commitf3d2029a61138d69437c1815a41fa6db3fd6198a (patch)
tree149ed8baa69561d4d82436388049189fa411ea23 /src/routes
parent0eb128fdd59cd550beda23549a47df75442d997f (diff)
downloadcoinos-ui-f3d2029a61138d69437c1815a41fa6db3fd6198a.tar.gz
coinos-ui-f3d2029a61138d69437c1815a41fa6db3fd6198a.zip
dm test
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/(app)/dm/+page.svelte19
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))}