Fixed get id of current well for Documents' requests

This commit is contained in:
KharchenkoVV 2021-08-12 10:03:44 +05:00
parent ac278edbf3
commit 03820c4c88

View File

@ -13,8 +13,8 @@ const pageSize = 12
const {RangePicker} = DatePicker; const {RangePicker} = DatePicker;
export default function Documents({idWell, selectedFileCategory}) { export default function Documents({selectedFileCategory}) {
// let {id} = useParams() let {id} = useParams()
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [range, setRange] = useState([]) const [range, setRange] = useState([])
@ -32,7 +32,7 @@ export default function Documents({idWell, selectedFileCategory}) {
try { try {
setLoader(true) setLoader(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']
} }
@ -101,7 +101,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,
@ -126,12 +126,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>