Skip to content

Commit 4a8c7e1

Browse files
authored
Merge pull request #187 from appwrite/fix-web-readonly-properties
fix(web): prevent url.search to be readonly property
2 parents 3e33f8d + 7992626 commit 4a8c7e1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

templates/web/src/sdk.ts.twig

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ class {{ spec.title | caseUcfirst }} {
8686
}
8787

8888
if (method === 'GET') {
89-
url.search = new URLSearchParams(this.flatten(params)).toString();
89+
for (const [key, value] of Object.entries(this.flatten(params))) {
90+
url.searchParams.append(key, value);
91+
}
9092
} else {
9193
switch (headers['content-type']) {
9294
case 'application/json':
@@ -210,8 +212,9 @@ class {{ spec.title | caseUcfirst }} {
210212
{% endfor %}
211213
{% endif %}
212214

213-
const query = new URLSearchParams(this.flatten(payload));
214-
uri.search = query.toString();
215+
for (const [key, value] of Object.entries(this.flatten(payload))) {
216+
uri.searchParams.append(key, value);
217+
}
215218
{% endif %}
216219
{% if method.type == 'webAuth' %}
217220
if (typeof window !== 'undefined' && window?.location) {

0 commit comments

Comments
 (0)