From 99aee9c7d9265d9963e045d418fb231813a002f2 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 16 Feb 2026 21:25:22 -0800 Subject: currency toggle --- src/routes/(app)/account/[id]/+page.server.ts | 3 +++ src/routes/(app)/account/[id]/+page.svelte | 14 ++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/routes/(app)/account/[id]/+page.server.ts b/src/routes/(app)/account/[id]/+page.server.ts index 8e16f839..1a4e63eb 100644 --- a/src/routes/(app)/account/[id]/+page.server.ts +++ b/src/routes/(app)/account/[id]/+page.server.ts @@ -20,6 +20,9 @@ export const actions = { try { await post(`/account/${id}`, body, auth(cookies)); + if (body.updateUserCurrency === "on") { + await post("/user", { currency: body.currency }, auth(cookies)); + } } catch (e: any) { console.log(e); error(400, { message: e.message }); diff --git a/src/routes/(app)/account/[id]/+page.svelte b/src/routes/(app)/account/[id]/+page.svelte index 674cb067..3abc4bdc 100644 --- a/src/routes/(app)/account/[id]/+page.svelte +++ b/src/routes/(app)/account/[id]/+page.svelte @@ -31,6 +31,14 @@ ); let name = $state(data.account.name || displayType); let currency = $state(data.account.currency || data.user.currency); + let userCurrency = $derived(data.user.currency); + let currencyChanged = $derived(currency !== userCurrency); + let updateUserCurrency = $state(false); + + $effect(() => { + updateUserCurrency = currencyChanged; + }); + let autowithdraw = $state(data.account.autowithdraw || false); let threshold = $state(data.account.threshold || data.user.threshold || 1000000); let reserve = $state(data.account.reserve ?? 0); @@ -198,6 +206,12 @@ + {#if currencyChanged} +
+ Also update default currency to {currency} + +
+ {/if} {#if isCustodial}
-- cgit v1.2.3