This commit is contained in:
Фролов 2021-08-12 15:43:18 +05:00
commit e391e6a470

View File

@ -3,6 +3,7 @@ import { UploadOutlined } from '@ant-design/icons'
import DocumentCreationForm from './modalWindows/DocumentCreationForm'
import { FileService } from '../services/api'
import {useState, useEffect} from "react"
import { useParams } from "react-router-dom"
import notify from './notify'
import LoaderPortal from './LoaderPortal'
import locale from "antd/lib/locale/ru_RU"
@ -11,7 +12,8 @@ import moment from 'moment'
const pageSize = 12
const {RangePicker} = DatePicker;
export default function Documents({idWell, selectedFileCategory}) {
export default function Documents({selectedFileCategory}) {
let {id} = useParams()
const [page, setPage] = useState(1)
const [range, setRange] = useState([])
@ -29,7 +31,7 @@ export default function Documents({idWell, selectedFileCategory}) {
try {
setShowLoader(true)
await fetch(`/api/files/${idWell}/${row.id}`, {
await fetch(`/api/files/${id}/${row.id}`, {
headers: {
Authorization: 'Bearer ' + localStorage['token']
}
@ -98,7 +100,7 @@ export default function Documents({idWell, selectedFileCategory}) {
}
await FileService.getFilesInfo(
`${idWell}`,
`${id}`,
(page - 1) * pageSize,
pageSize,
selectedFileCategory,
@ -123,12 +125,12 @@ export default function Documents({idWell, selectedFileCategory}) {
}
)
} catch (ex) {
notify(`Не удалось загрузить файлы по скважине "${idWell}"`, 'error')
notify(`Не удалось загрузить файлы по скважине "${id}"`, 'error')
console.log(ex)
}
}
GetDocuments()
}, [idWell, range, page, selectedFileCategory, isTableUpdating])
}, [id, range, page, selectedFileCategory, isTableUpdating])
return (
<div>