Skip to content

Commit

Permalink
Declare responseP and responseL in .then
Browse files Browse the repository at this point in the history
  • Loading branch information
Fosten committed Jun 4, 2024
1 parent 938a2e6 commit b01f0ef
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/components/Blocks/PlantAssets/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,24 @@ const View = (props) => {
const origplantID = arrI[count];

const planttypeURL = arrP[count];
const responseP = await axiosClient.get(planttypeURL);
const objectPName = {
[`${origplantID}`]: responseP.data.data[0]?.attributes.name,
};
arrayP.push({ objectPName });

await axiosClient.get(planttypeURL).then(async (responseP) => {
const objectPName = {
[`${origplantID}`]: responseP.data.data[0]?.attributes.name,
};
arrayP.push({ objectPName });
});
const locationURL = arrL[count];
const responseL = await axiosClient.get(locationURL);
var arr = [];
for (let Lcount = 0; Lcount < 5; Lcount++) {
var i = responseL.data.data[Lcount]?.attributes.name;
arr.push(i);
}
const objectLName = {
[`${origplantID}`]: arr,
};
arrayL.push({ objectLName });

await axiosClient.get(locationURL).then(async (responseL) => {
var arr = [];
for (let Lcount = 0; Lcount < 5; Lcount++) {
var i = responseL.data.data[Lcount]?.attributes.name;
arr.push(i);
}
const objectLName = {
[`${origplantID}`]: arr,
};
arrayL.push({ objectLName });
});
}
setState2(arrayP);
setState3(arrayL);
Expand Down

0 comments on commit b01f0ef

Please sign in to comment.