aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
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
parent2a18749cb9b08726dedf0cfb63971305e50a910a (diff)
downloadcoinos-ui-f1b3efe88204ba203667a8dd67ac8ab598af1959.tar.gz
coinos-ui-f1b3efe88204ba203667a8dd67ac8ab598af1959.zip
sveltekit 1.0
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/invoice.js7
-rw-r--r--src/lib/utils.js9
2 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/invoice.js b/src/lib/invoice.js
index f0c5aad5..983cde2a 100644
--- a/src/lib/invoice.js
+++ b/src/lib/invoice.js
@@ -29,9 +29,6 @@ export default async ({ cookies, request, url }) => {
throw redirect(307, `/${user.username}/request/${request_id}`);
}
- if (invoice.prompt) {
- throw redirect(307, `/invoice/${hash}/tip`);
- } else {
- throw redirect(307, `/invoice/${hash}`);
- }
+ if (invoice.prompt) throw redirect(307, `/invoice/${hash}/tip`);
+ else throw redirect(307, `/invoice/${hash}`);
};
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()
);