diff options
| author | Adam Soltys <[email protected]> | 2026-02-16 21:25:22 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-16 21:25:22 -0800 |
| commit | 99aee9c7d9265d9963e045d418fb231813a002f2 (patch) | |
| tree | 152483d4f29ca200b02979e83cc0bea3d4365074 /src | |
| parent | 314c86901e8aadf731d0ab235ef371248670e940 (diff) | |
| download | coinos-ui-99aee9c7d9265d9963e045d418fb231813a002f2.tar.gz coinos-ui-99aee9c7d9265d9963e045d418fb231813a002f2.zip | |
currency toggle
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/account/[id]/+page.server.ts | 3 | ||||
| -rw-r--r-- | src/routes/(app)/account/[id]/+page.svelte | 14 |
2 files changed, 17 insertions, 0 deletions
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 @@ </select> </div> + {#if currencyChanged} + <div class="flex justify-between items-center"> + <span>Also update default currency to {currency}</span> + <Toggle id="updateUserCurrency" bind:value={updateUserCurrency} /> + </div> + {/if} {#if isCustodial} <div> |
