aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-08-30 20:04:13 -0700
committerAdam Soltys <[email protected]>2024-08-30 20:04:13 -0700
commit20337319212896c484ac0f8d3dfbac3b8d26f089 (patch)
tree591c0aa104320813a3b7d2579acd5cf8b401842b
parent3e2d9c5758d92fccc19e44842e0b9d4a252630ff (diff)
downloadcoinos-ui-20337319212896c484ac0f8d3dfbac3b8d26f089.tar.gz
coinos-ui-20337319212896c484ac0f8d3dfbac3b8d26f089.zip
typescript
-rw-r--r--src/lib/handler.ts2
-rw-r--r--src/lib/invoice.ts3
-rw-r--r--src/lib/parse.ts6
-rw-r--r--src/lib/socket.ts3
-rw-r--r--src/lib/translations/index.js11
-rw-r--r--src/routes/(app)/[username]/(profile)/event/[id]/+page.server.js2
6 files changed, 8 insertions, 19 deletions
diff --git a/src/lib/handler.ts b/src/lib/handler.ts
index 05e484ec..03795ad9 100644
--- a/src/lib/handler.ts
+++ b/src/lib/handler.ts
@@ -2,7 +2,7 @@ import { goto } from "$app/navigation";
import { applyAction } from "$app/forms";
export default (submitting) =>
- ({ formElement, formData, action, cancel }) => {
+ () => {
submitting = true;
return async ({ result }) => {
if (result.type === "redirect") {
diff --git a/src/lib/invoice.ts b/src/lib/invoice.ts
index d2d3d13d..7897dadc 100644
--- a/src/lib/invoice.ts
+++ b/src/lib/invoice.ts
@@ -1,7 +1,7 @@
import { auth, get, post } from "$lib/utils";
import { redirect } from "@sveltejs/kit";
-export default async ({ cookies, request, url }) => {
+export default async ({ cookies, request }) => {
let form = await request.formData();
let rates = await get("/rates");
@@ -16,6 +16,7 @@ export default async ({ cookies, request, url }) => {
type: form.get("type"),
prompt: form.get("prompt") === "true",
rate: parseFloat(form.get("rate")) || rates[form.get("currency")],
+ id: undefined
};
let user = { username: form.get("username"), currency: form.get("currency") };
diff --git a/src/lib/parse.ts b/src/lib/parse.ts
index 09c6f320..6995f207 100644
--- a/src/lib/parse.ts
+++ b/src/lib/parse.ts
@@ -1,10 +1,10 @@
-import { auth, get, isLiquid, post } from "$lib/utils";
+import { get, isLiquid, post } from "$lib/utils";
import bip21 from "bip21";
import { validate } from "bitcoin-address-validation";
import { PUBLIC_DOMAIN } from "$env/static/public";
import { redirect } from "@sveltejs/kit";
-export default async (t, host, cookies) => {
+export default async (t, host) => {
if (!t) return;
if (t.startsWith("http")) redirect(307, t);
@@ -58,7 +58,7 @@ export default async (t, host, cookies) => {
}
if (t.startsWith("cashu")) {
- let { id } = await post("/cash", { token: t }, auth);
+ let { id } = await post("/cash", { token: t });
redirect(307, `/ecash/${id}`);
}
diff --git a/src/lib/socket.ts b/src/lib/socket.ts
index 98d42ead..c82810c9 100644
--- a/src/lib/socket.ts
+++ b/src/lib/socket.ts
@@ -1,10 +1,9 @@
import { navigating } from "$app/stores";
import { get } from "svelte/store";
-import { event, invoice, request, newPayment, last } from "$lib/store";
+import { event, invoice, request, last } from "$lib/store";
import { success, sat, sleep } from "$lib/utils";
import { PUBLIC_SOCKET } from "$env/static/public";
import { invalidate } from "$app/navigation";
-import { browser } from "$app/environment";
let socket, token;
diff --git a/src/lib/translations/index.js b/src/lib/translations/index.js
index f8fbd9c2..ae2fcedf 100644
--- a/src/lib/translations/index.js
+++ b/src/lib/translations/index.js
@@ -1,22 +1,11 @@
import i18n from "sveltekit-i18n";
import lang from "./lang.json";
-// setup loaders & translations from lang.json data
-function createLocaleLoader(localeCode) {
- return {
- locale: localeCode,
- key: "",
- loader: async () =>
- (await import(`../../locales/${localeCode}.json`)).default,
- };
-}
-
const availableLocales = Object.keys(lang);
const trans = {};
for (let i = 0; i < availableLocales.length; i++) {
trans[availableLocales[i]] = { lang };
}
-const loaders = availableLocales.map(createLocaleLoader);
export const defaultLocale = "en";
diff --git a/src/routes/(app)/[username]/(profile)/event/[id]/+page.server.js b/src/routes/(app)/[username]/(profile)/event/[id]/+page.server.js
index 24f2b611..42c568c5 100644
--- a/src/routes/(app)/[username]/(profile)/event/[id]/+page.server.js
+++ b/src/routes/(app)/[username]/(profile)/event/[id]/+page.server.js
@@ -6,7 +6,7 @@ export async function load({ params: { id } }) {
let event = await get(`/event/${id}`);
if (!event) error(500, "Event not found");
return { event };
- } catch (e) {
+ } catch (e: Error) {
error(500, e.message);
}
}