Conversation
| && response.data.result.status === 200 && response.data.result.content | ||
| && response.data.result.content.length === 1) { | ||
| return response.data.result.content[0]; | ||
| if (response.data && response.status === 200 && response.data.length === 1) { |
There was a problem hiding this comment.
[❗❗ correctness]
The change from response.data.result.content to response.data assumes that the API response structure has changed. Ensure that this change is reflected across all parts of the application that consume this data, as it could lead to unexpected errors if other parts of the codebase still expect the old structure.
| }).then((res) => { | ||
| logger.debug(`Role info by ${roleId}: ${JSON.stringify(res.data.result.content)}`); | ||
| return _.get(res, 'data.result.content', []); | ||
| logger.debug(`Role info by ${roleId}: ${JSON.stringify(res.data)}`); |
There was a problem hiding this comment.
[❗❗ correctness]
The change from res.data.result.content to res.data assumes a different response structure. Verify that this change is consistent with the API's documentation and that all consuming code is updated accordingly to prevent runtime errors.
| const roles = res.data; | ||
| logger.debug(`Roles by ${roleName}: ${JSON.stringify(roles)}`); | ||
| return roles.result.content | ||
| return roles |
There was a problem hiding this comment.
[❗❗ correctness]
The change from roles.result.content to roles assumes a different response structure. Ensure that this change is consistent with the API's documentation and that all consuming code is updated accordingly to prevent runtime errors.
| logger.debug(`Roles for user ${userId}: ${JSON.stringify(res.data.result.content)}`); | ||
| return _.get(res, 'data.result.content', []).map(r => r.roleName); | ||
| logger.debug(`Roles for user ${userId}: ${JSON.stringify(res.data)}`); | ||
| return (res.data || []).map(r => r.roleName); |
There was a problem hiding this comment.
[❗❗ correctness]
The change from res.data.result.content to res.data assumes a different response structure. Ensure that this change is consistent with the API's documentation and that all consuming code is updated accordingly to prevent runtime errors.
| .then((response) => { | ||
| const data = _.get(response, 'data.result.content', null); | ||
| if (!data) { throw new Error('Response does not have result.content'); } | ||
| const data = _.get(response, 'data', null); |
There was a problem hiding this comment.
[❗❗ correctness]
The change from response.data.result.content to response.data assumes a different response structure. Ensure that this change is consistent with the API's documentation and that all consuming code is updated accordingly to prevent runtime errors.
| .then((responses) => { | ||
| const data = responses.reduce((contents, response) => { | ||
| const content = _.get(response, 'data.result.content', []); | ||
| const content = response.data || []; |
There was a problem hiding this comment.
[❗❗ correctness]
The change from response.data.result.content to response.data assumes a different response structure. Ensure that this change is consistent with the API's documentation and that all consuming code is updated accordingly to prevent runtime errors.
No description provided.