From 0bf630c39fe290ea2718eab7a0759d978c736ef9 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Nov 2024 13:08:08 -0800 Subject: bip21 and socket fixes --- src/routes/(app)/+layout.server.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/routes/(app)/+layout.server.ts') diff --git a/src/routes/(app)/+layout.server.ts b/src/routes/(app)/+layout.server.ts index 3c5b3b3e..d490a684 100644 --- a/src/routes/(app)/+layout.server.ts +++ b/src/routes/(app)/+layout.server.ts @@ -3,7 +3,7 @@ import { error, redirect } from "@sveltejs/kit"; export async function load({ cookies, request, url, params }) { const { pathname } = url; - const { username } = params; + const { id, username } = params; const token = cookies.get("token"); let rate; let rates = { USD: 1 }; @@ -20,7 +20,14 @@ export async function load({ cookies, request, url, params }) { } let subject; - if (username) { + + if (url.pathname.startsWith("/invoice") && id) { + try { + ({ user: subject } = await get(`/invoice/${id}`)); + } catch (e) { + console.log("unable to fetch invoice", id, e); + } + } else if (username) { try { subject = await get(`/users/${username}`); } catch (e) { -- cgit v1.2.3