Below is the script that I am currently working with:
const [firstResponse, secondResponse] = await Promise.all([
this.$store.dispatch(Actions.RELATIONS),
ApiService.get("/api/"+ this.apiEndpointSingle +'/'+this.uid)
]);
console.log(secondResponse)
this.formData = secondResponse.data.result[this.apiEndpointSingle];
After logging the variable secondResponse
, it seems to return an unexpected JSON value at the key "tags" as an empty array. This is puzzling and new to me.
Initial API Response:
{
"id": 1,
"created_at": "2021-06-15T12:10:41.000000Z",
"updated_at": null,
"created_by": 1,
"status": 1,
"uid": null,
"tags": "[\"2\"]",
"sale_status": "completed",
"reference": "test1",
"sale_date": "2021-06-17T14:33:00.000000Z",
"currency": null,
"connection_id": null,
"relation_id": 1,
"profile_id": 1,
"address_id": 1,
"profile_name": "P1",
"relation_name": "R1"
}
Updated Output post console logging secondResponse
:
{
"id": 1,
"created_at": "2021-06-15T12:10:41.000000Z",
"updated_at": null,
"created_by": 1,
"status": 1,
"uid": null,
"tags": [],
"sale_status": "completed",
"reference": "test1",
"sale_date": "2021-06-17T14:33:00.000000Z",
"currency": null,
"connection_id": null,
"relation_id": 1,
"profile_id": 1,
"address_id": 1,
"profile_name": "P1",
"relation_name": "R1"
}