Skip to content

Commit 65e6433

Browse files
Merge pull request #419 from appwrite/fix-cli-user-prefs
Fix: JSON object parsing
2 parents bbafc52 + 5739f4d commit 65e6433

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

templates/cli/lib/commands/command.js.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
5555
payload['{{ parameter.name }}'] = filePath;
5656
}
5757

58+
{% elseif parameter.type == 'object' %}
59+
if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') {
60+
payload['{{ parameter.name }}'] = JSON.parse({{ parameter.name | caseCamel | escapeKeyword}});
61+
}
62+
5863
{% else %}
5964
if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') {
6065
payload['{{ parameter.name }}'] = {{ parameter.name | caseCamel | escapeKeyword}}{% if method.consumes[0] == "multipart/form-data" and ( parameter.type != "string" and parameter.type != "array" ) %}.toString(){% endif %};

0 commit comments

Comments
 (0)