aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/settings.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-09 23:44:40 -0800
committerAdam Soltys <[email protected]>2025-01-09 23:44:40 -0800
commit7ab6a3d04ff34c8987d204bd71289609f9fd0523 (patch)
tree4c1e39704e2edb332c5fe8c58fb0d81c8154af2b /src/lib/settings.ts
parente37fa03f08b47d780f9e7f2b3d14125c33ba1b7d (diff)
downloadcoinos-ui-7ab6a3d04ff34c8987d204bd71289609f9fd0523.tar.gz
coinos-ui-7ab6a3d04ff34c8987d204bd71289609f9fd0523.zip
nostr signing
Diffstat (limited to 'src/lib/settings.ts')
-rw-r--r--src/lib/settings.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/settings.ts b/src/lib/settings.ts
index 3ce1edd5..53a25e18 100644
--- a/src/lib/settings.ts
+++ b/src/lib/settings.ts
@@ -1,4 +1,4 @@
-import { auth, fd, get, post } from "$lib/utils";
+import { auth, fd, post } from "$lib/utils";
import { fail } from "@sveltejs/kit";
type Error = {
@@ -16,16 +16,14 @@ export default async ({ cookies, request }) => {
form.autowithdraw = form.autowithdraw === "on";
}
- let user = { ...(await get("/me", auth(cookies))), ...form };
-
try {
- ({ user } = await post("/user", user, auth(cookies)));
+ const { user } = await post("/user", form, auth(cookies));
+
+ if (user.language) cookies.set("lang", user.language, { path: "/" });
+
+ return { user, success: true };
} catch (e) {
const { message } = e as Error;
return fail(400, { message });
}
-
- if (user.language) cookies.set("lang", user.language, { path: "/" });
-
- return { user, success: true };
};