Rework GraphQL proxy to produce response in the same format as the commercetools API
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3553750. -->
Reported by: [murz](https://www.drupal.org/user/157092)
Related to !73
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>The commercetools GraphQL API returns the data in the "data" object, but our GraphQL proxy returns it in the root object.<br>
Because of this, we implemented an "if" condition to handle this on the frontend - <code>modules/commercetools_decoupled/js/libs/commercetoolsApi.js</code>:</p>
<pre> if (isDirectRequest) {<br> // @todo Rework backend GraphQL proxy to return data in the same<br> // format as commercetools GraphQL.<br> Object.assign(result.body, result.body.data);<br> delete result.body.data;<br> }</pre><h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>We need to fix our GraphQL proxy to produce results in the same format as the direct commercetools API responses and remove this "if" condition.</p>
issue