fix Archive page

This commit is contained in:
Фролов 2021-08-20 15:43:13 +05:00
parent 7435bb86b5
commit ca9ffe3bd9

View File

@ -5,7 +5,6 @@ import {
Row,
Col,
Tooltip} from 'antd'
import { useParams } from 'react-router-dom'
import { DataService } from '../services/api'
import {generateUUID} from '../services/UidGenerator'
import { ArchiveColumn } from '../components/ArchiveColumn'
@ -25,8 +24,7 @@ const LoadObject = (key) => {
return json ? JSON.parse(json) : null
}
export default function Archive() {
let { id } = useParams();
export default function Archive({idWell}) {
const [saubData, setSaubData] = useState([])
const [chartsCfgs, setChartsCfgs] = useState([])
const [rangeDate, setRangeDate] = useState([moment().subtract(3,'hours'), moment()])
@ -96,14 +94,14 @@ export default function Archive() {
let startDate = rangeDate[0].toISOString()
setLoader(true)
DataService.getData(id, startDate, interval, 2048)
DataService.getData(idWell, startDate, interval, 2048)
.then(handleReceiveDataSaub)
.catch(error => {
notify(`Не удалось загрузить данные по скважине (${id}) c ${rangeDate[0]} по ${rangeDate[1]}`, 'error')
notify(`Не удалось загрузить данные по скважине (${idWell}) c ${rangeDate[0]} по ${rangeDate[1]}`, 'error')
console.error(error)
})
.finally(()=>setLoader(false))
}, [id, rangeDate]);
}, [idWell, rangeDate]);
let charts = null
if(chartsCfgs.length > 0){