Skip to content

Commit 09d3b56

Browse files
committed
fix: couple of small enhancement fixes
1 parent 7eca70e commit 09d3b56

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/PortalLink.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import { type GeneratePortalUrlParams } from "@kinde/js-utils";
33
import { browser } from "$app/environment";
44
5-
export let options: Partial <Omit<GeneratePortalUrlParams, "domain">> = {};
5+
export let options: Partial<Omit<GeneratePortalUrlParams, "domain">> = {};
66
77
function portal() {
88
if (!browser) return;
99
const path = "/api/auth/portal";
1010
11-
if(!options.returnUrl) {
12-
options.returnUrl = window.location
13-
}
11+
if (!options.returnUrl) {
12+
options.returnUrl = window.location.href;
13+
}
1414
1515
const params = new URLSearchParams(
1616
options as Record<string, string>,

src/lib/handleAuth/handleAuth.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ export async function handleAuth({
9393
redirect(302, url.toString());
9494
}
9595

96-
const openPortal = async (request: SessionManager, options: Record<string, string | number>) => {
96+
const openPortal = async (
97+
request: SessionManager,
98+
options: Record<string, string | number>,
99+
) => {
97100
const accessToken = await request.getSessionItem("access_token");
98101
if (!accessToken) {
99102
throw error(401, "User not authenticated");
@@ -102,14 +105,15 @@ const openPortal = async (request: SessionManager, options: Record<string, strin
102105
const storage = new MemoryStorage();
103106
setActiveStorage(storage);
104107
await storage.setSessionItem(StorageKeys.accessToken, accessToken);
105-
let portalUrl
108+
let portalUrl;
106109
try {
107-
portalUrl = await generatePortalUrl({...options, domain: kindeConfiguration.authDomain});
108-
console.log('portalUrl:', portalUrl);
109-
console.log('options:', options);
110+
portalUrl = await generatePortalUrl({
111+
...options,
112+
domain: kindeConfiguration.authDomain,
113+
});
110114
} catch (err) {
111-
console.log('err:', err);
112-
throw error(500, "Failed to generate portal URL",);
115+
console.log("err:", err);
116+
throw error(500, "Failed to generate portal URL");
113117
}
114118
redirect(302, portalUrl.url.toString());
115119
};
@@ -147,4 +151,4 @@ const redirectToPostLoginUrl = async () => {
147151
);
148152
}
149153
}
150-
};
154+
};

0 commit comments

Comments
 (0)