aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-15 15:24:43 -0800
committerAdam Soltys <[email protected]>2023-12-15 15:24:43 -0800
commit7d598265e60eecf06a27501a85e8db330aeed381 (patch)
tree80c73666f5ba3c5f852ac961dd0cf01e551c7896 /src/routes/(app)/send
parent310687af30375e87679ea5a9ff3fef5a8f4f12fa (diff)
downloadcoinos-ui-7d598265e60eecf06a27501a85e8db330aeed381.tar.gz
coinos-ui-7d598265e60eecf06a27501a85e8db330aeed381.zip
sveltekit 2
Diffstat (limited to 'src/routes/(app)/send')
-rw-r--r--src/routes/(app)/send/[...text]/+page.server.js24
-rw-r--r--src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.server.js2
-rw-r--r--src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js2
-rw-r--r--src/routes/(app)/send/invoice/[id]/+page.server.js6
-rw-r--r--src/routes/(app)/send/lightning/[payreq]/+page.server.js2
-rw-r--r--src/routes/(app)/send/user/[username]/[...amount]/+page.server.js8
6 files changed, 22 insertions, 22 deletions
diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js
index 9a76f21d..3e6b7c13 100644
--- a/src/routes/(app)/send/[...text]/+page.server.js
+++ b/src/routes/(app)/send/[...text]/+page.server.js
@@ -7,8 +7,8 @@ import { PUBLIC_DOMAIN } from "$env/static/public";
let parse = async (t, host) => {
if (!t) return;
- if (t.startsWith("http")) throw redirect(307, t);
- if (t.startsWith(host)) throw redirect(307, `http://${t}`);
+ if (t.startsWith("http")) redirect(307, t);
+ if (t.startsWith(host)) redirect(307, `http://${t}`);
let amount, user, id;
@@ -28,12 +28,12 @@ let parse = async (t, host) => {
if (t.endsWith("@classic")) {
({ uuid: id } = await get(`/invoice/classic/${t.replace("@classic", "")}`));
- if (id) throw redirect(307, `/send/invoice/${id}`);
+ if (id) redirect(307, `/send/invoice/${id}`);
}
- if (t.includes("/fund")) throw redirect(307, t.substring(t.indexOf("/fund")));
+ if (t.includes("/fund")) redirect(307, t.substring(t.indexOf("/fund")));
- if (t.toLowerCase().startsWith("lnurl")) throw redirect(307, `/ln/${t}`);
+ if (t.toLowerCase().startsWith("lnurl")) redirect(307, `/ln/${t}`);
if (t.includes(":")) t = t.split(":")[1];
// lightning
@@ -41,7 +41,7 @@ let parse = async (t, host) => {
try {
({ id } = await get(`/invoice/${t}`));
} catch (e) {
- throw redirect(307, `/send/lightning/${t}`);
+ redirect(307, `/send/lightning/${t}`);
}
}
@@ -52,11 +52,11 @@ let parse = async (t, host) => {
} catch (e) {
let r = `/send/bitcoin/${t}`;
if (amount) r += "/" + amount;
- throw redirect(307, r);
+ redirect(307, r);
}
- if (user) throw redirect(307, `/send/${user.username}`);
- else if (id) throw redirect(307, `/send/${id}`);
+ if (user) redirect(307, `/send/${user.username}`);
+ else if (id) redirect(307, `/send/${id}`);
}
// user
@@ -65,14 +65,14 @@ let parse = async (t, host) => {
if (user.anon) user = null;
} catch (e) {}
- if (user) throw redirect(307, `/send/user/${t}`);
+ if (user) redirect(307, `/send/user/${t}`);
let fund;
try {
fund = await get(`/fund/${t}`);
} catch (e) {}
- if (fund) throw redirect(307, `/send/fund/${t}`);
+ if (fund) redirect(307, `/send/fund/${t}`);
// invoice
let invoice;
@@ -80,7 +80,7 @@ let parse = async (t, host) => {
invoice = await get(`/invoice/${t}`);
} catch (e) {}
- if (invoice) throw redirect(307, `/send/invoice/${invoice.hash}`);
+ if (invoice) redirect(307, `/send/invoice/${invoice.hash}`);
};
export async function load({ cookies, params, request, url }) {
diff --git a/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.server.js b/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.server.js
index aaccf762..2998f22a 100644
--- a/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.server.js
+++ b/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.server.js
@@ -35,6 +35,6 @@ export const actions = {
return fail(400, { message: e.message });
}
- throw redirect(307, "/sent");
+ redirect(307, "/sent");
},
};
diff --git a/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js b/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js
index 3318a60b..51277e5d 100644
--- a/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js
+++ b/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js
@@ -12,6 +12,6 @@ export const actions = {
return fail(400, { message: e.message });
}
- if (p) throw redirect(307, `/fund/${body.name}`);
+ if (p) redirect(307, `/fund/${body.name}`);
},
};
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js
index aa284328..39f2a5dd 100644
--- a/src/routes/(app)/send/invoice/[id]/+page.server.js
+++ b/src/routes/(app)/send/invoice/[id]/+page.server.js
@@ -17,9 +17,9 @@ export async function load({ params: { id }, parent, url }) {
} = await get(`/invoice/${id}`);
if (prompt && tip === null)
- throw redirect(307, `/${recipient.username}/invoice/${id}/tip`);
+ redirect(307, `/${recipient.username}/invoice/${id}/tip`);
if (recipient.username === user.username)
- throw error(500, { message: "Cannot send to self" });
+ error(500, { message: "Cannot send to self" });
return {
amount,
address,
@@ -43,6 +43,6 @@ export const actions = {
return fail(400, { message: e.message });
}
- throw redirect(307, "/sent");
+ redirect(307, "/sent");
},
};
diff --git a/src/routes/(app)/send/lightning/[payreq]/+page.server.js b/src/routes/(app)/send/lightning/[payreq]/+page.server.js
index d9e791e1..49c952bf 100644
--- a/src/routes/(app)/send/lightning/[payreq]/+page.server.js
+++ b/src/routes/(app)/send/lightning/[payreq]/+page.server.js
@@ -19,6 +19,6 @@ export const actions = {
return fail(400, { message: e.message });
}
- throw redirect(307, "/sent");
+ redirect(307, "/sent");
},
};
diff --git a/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js b/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
index 1f3a0420..e5fa4452 100644
--- a/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
+++ b/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
@@ -9,12 +9,12 @@ export async function load({ cookies, params, parent }) {
let [amount, currency] = params.amount.split("/");
if (subject.username === user?.username)
- throw error(500, { message: "Cannot send to self" });
+ error(500, { message: "Cannot send to self" });
let rate;
if (amount) {
rate = rates[currency ? currency.toUpperCase() : subject.currency];
- if (!rate) throw error(500, "Invalid currency symbol");
+ if (!rate) error(500, "Invalid currency symbol");
if (currency) amount = (amount * sats) / rate;
let { hash } = await post(
@@ -26,7 +26,7 @@ export async function load({ cookies, params, parent }) {
auth(cookies)
);
- throw redirect(307, `/${username}/invoice/${hash}`);
+ redirect(307, `/${username}/invoice/${hash}`);
}
return { amount, rate, subject };
@@ -42,6 +42,6 @@ export const actions = {
return fail(400, { message: e.message });
}
- throw redirect(307, "/sent");
+ redirect(307, "/sent");
},
};