From f1b3efe88204ba203667a8dd67ac8ab598af1959 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 25 Jan 2023 23:01:55 -0800 Subject: sveltekit 1.0 --- src/lib/utils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/lib/utils.js') 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() ); -- cgit v1.2.3