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