Skip to content

Commit 5a14b7a

Browse files
committed
chore: added condition to adding payload
1 parent e790b38 commit 5a14b7a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

templates/web/src/services/template.ts.twig

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,19 @@ export class {{ service.name | caseUcfirst }} {
6969
}
7070

7171
{%~ if method.type == 'location' or method.type == 'webAuth' %}
72+
{%~ if method.auth|length > 0 %}
73+
{%~ for node in method.auth %}
74+
{%~ for key,header in node|keys %}
75+
payload['{{header|caseLower}}'] = this.client.config.{{header|caseLower}};
76+
{%~ endfor %}
77+
{%~ endfor %}
78+
{%~ endif %}
79+
7280
for (const [key, value] of Object.entries(Service.flatten(payload))) {
7381
uri.searchParams.append(key, value);
7482
}
83+
7584
{%~ endif %}
76-
7785
{%~ if method.type == 'webAuth' %}
7886
if (typeof window !== 'undefined' && window?.location) {
7987
window.location.href = uri.toString();

0 commit comments

Comments
 (0)