diff --git a/src/components/CreditStages/CreditStage5.js b/src/components/CreditStages/CreditStage5.js index 4619ed9..4334ff1 100644 --- a/src/components/CreditStages/CreditStage5.js +++ b/src/components/CreditStages/CreditStage5.js @@ -37,18 +37,24 @@ const CreditStage5 = ({ setStage, data, setData, creditData, id }) => { if (creditData) { creditData.data.map((el) => { if (el.id === id) { - if (JSON.parse(el.translations[0].attribute_data).documents) { + if ( + JSON.parse( + el.translations.find((els) => els.locale === "ru").attribute_data + ).documents + ) { setReq({ ...req, TKM: el.documents, - rus: JSON.parse(el.translations[0].attribute_data).documents, - }); - } else if (JSON.parse(el.translations[1].attribute_data).documents) - setReq({ - ...req, - TKM: el.documents, - rus: JSON.parse(el.translations[1].attribute_data).documents, + rus: JSON.parse( + el.translations.find((els) => els.locale === "ru") + .attribute_data + ).documents, + ENG: JSON.parse( + el.translations.find((els) => els.locale === "en") + .attribute_data + ).documents, }); + } } }); } @@ -94,7 +100,14 @@ const CreditStage5 = ({ setStage, data, setData, creditData, id }) => {