aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-01-26 00:06:00 -0800
committerAdam Soltys <[email protected]>2024-01-26 00:33:50 -0800
commit3444b3c0fb349395a02d6db1eeaef57460b1a37f (patch)
treeaf815eafd6c6075d49c8231efd955531376d993e /src/lib/utils.js
parent01fdad8ee4e6bb4213c0c81a8876cda67ad3085a (diff)
downloadcoinos-ui-3444b3c0fb349395a02d6db1eeaef57460b1a37f.tar.gz
coinos-ui-3444b3c0fb349395a02d6db1eeaef57460b1a37f.zip
update translations
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 4ffbb8b0..81f5a80f 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -105,7 +105,7 @@ let recent = [];
export let success = (m, clear = true) => {
if (recent.includes(m)) return;
recent.push(m);
- setTimeout(() => (recent = []), 5000);
+ setTimeout(() => (recent = []), 5000);
if (clear) toast.pop();
toast.push(m, {
theme: {
@@ -114,7 +114,7 @@ export let success = (m, clear = true) => {
});
};
- export let warning = (m, clear = true) => {
+export let warning = (m, clear = true) => {
if (clear) toast.pop();
toast.push(m, {
theme: {
@@ -156,13 +156,14 @@ export let login = async (user, cookies, ip) => {
if (text.startsWith("2fa")) throw new Error("2fa");
}
- let { token } = await res.json();
+ let { user: u, token } = await res.json();
if (!token) throw new Error("Login failed");
let expires = new Date();
expires.setSeconds(expires.getSeconds() + maxAge);
let opts = { path: "/", expires };
+ if (u.language) cookies.set("lang", u.language, opts);
cookies.set("username", user.username, opts);
cookies.set("token", token, opts);
};