diff --git a/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx b/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx index 9d2209f..135334f 100644 --- a/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx +++ b/src/webparts/summaryWebPart/components/SummaryContainer/SummaryContainer.tsx @@ -31,6 +31,39 @@ export default class SummaryContainer extends React.Component, prjGuid: string): + Promise> + { + const lastPublishedDateObj = { + key: 200000, + fieldName: 'Дата публикации основного КПП', + value: undefined + } + + const encodedUrl = encodeURI(`http://portal.vertex.spb.ru/pwa/_api/ProjectData/Проекты(guid'${prjGuid}')`) + + const response = await fetch(encodedUrl, + { headers: { + 'accept': 'application/json', + }}) + const json = await response.json() + + if (!json) { + console.error('addMainProjectPlanLastPublishedDate json is invalid =>', json) + return toState + } + + const date = json.ProjectLastPublishedDate + + if (!date) { + console.error('addMainProjectPlanLastPublishedDate json.ProjectLastPublishedDate is invalid =>', date) + return toState + } + + lastPublishedDateObj.value = new Date(date).toLocaleDateString() + return [ ...toState, lastPublishedDateObj ] + } + componentDidMount() { const { order, context } = this.props; let relUrl = context.pageContext.web.serverRelativeUrl; @@ -69,7 +102,7 @@ export default class SummaryContainer extends React.Component { + .then(async currentProject => { res.forEach(e=>{ @@ -89,6 +122,9 @@ export default class SummaryContainer extends React.Component