aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-25 23:01:55 -0800
committerAdam Soltys <[email protected]>2023-01-25 23:01:55 -0800
commitf1b3efe88204ba203667a8dd67ac8ab598af1959 (patch)
tree071975ffa4c30f81a7a25b78b4cfd5f85fdf7ea5 /src/lib/utils.js
parent2a18749cb9b08726dedf0cfb63971305e50a910a (diff)
downloadcoinos-ui-f1b3efe88204ba203667a8dd67ac8ab598af1959.tar.gz
coinos-ui-f1b3efe88204ba203667a8dd67ac8ab598af1959.zip
sveltekit 1.0
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js
index e6325e9f..bb6b34fa 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -137,8 +137,9 @@ export const login = async (user, cookies) => {
let expires = new Date();
expires.setSeconds(expires.getSeconds() + maxAge);
- cookies.set('username', user.username, { path: '/', expires });
- cookies.set('token', token, { path: '/', expires });
+ let opts = { path: '/', expires }
+ cookies.set('username', user.username, opts);
+ cookies.set('token', token, opts);
};
export const auth = (cookies) => ({ authorization: `Bearer ${cookies.get('token')}` });
@@ -160,8 +161,8 @@ export const sat = (s) => {
return (
'⚡️' +
(parseInt(s) > 0
- ? new Intl.NumberFormat('en-US', { maximumFractionDigits: 1 }).format(s / Math.pow(1000, d)) +
- ['', 'K', 'M', 'G', 'T', 'P'][d]
+ ? new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 }).format(s / Math.pow(1000, d)) +
+ ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z'][d]
: 0
).toString()
);