Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit 0c504fd

Browse files
committed
Fix conditional tokens
1 parent 369e71f commit 0c504fd

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ const saveState = (newState: Partial<APIState>) =>
2121
const priorSettings = getState() ?? {};
2222

2323
const token = new URL(window.location.href).searchParams.get("token");
24+
const defaultURL = new URL(window.location.origin);
2425

25-
const baseURL = priorSettings.baseURL ?? `${window.location.origin}?token=${token}`;
26+
if (token) {
27+
defaultURL.searchParams.set('token', token);
28+
}
29+
30+
const baseURL = priorSettings.baseURL ?? defaultURL.href;
2631
const headless = priorSettings.headless ?? true;
2732
const stealth = priorSettings.stealth ?? false;
2833
const blockAds = priorSettings.blockAds ?? false;

0 commit comments

Comments
 (0)