Skip to content

Commit 2e95c34

Browse files
fix(client): preserve URL params already embedded in path
1 parent 2e885d3 commit 2e95c34

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,9 @@ export class Flowglad {
398398
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
399399

400400
const defaultQuery = this.defaultQuery();
401-
if (!isEmptyObj(defaultQuery)) {
402-
query = { ...defaultQuery, ...query };
401+
const pathQuery = Object.fromEntries(url.searchParams);
402+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
403+
query = { ...pathQuery, ...defaultQuery, ...query };
403404
}
404405

405406
if (typeof query === 'object' && query && !Array.isArray(query)) {

0 commit comments

Comments
 (0)