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;
export default function Documents({idWell, selectedFileCategory}) {
// let {id} = useParams()
export default function Documents({selectedFileCategory}) {
let {id} = useParams()
const [page, setPage] = useState(1)
const [range, setRange] = useState([])
@ -32,7 +32,7 @@ export default function Documents({idWell, selectedFileCategory}) {
try {
setLoader(true)
await fetch(`/api/files/${idWell}/${row.id}`, {
await fetch(`/api/files/${id}/${row.id}`, {
headers: {
Authorization: 'Bearer ' + localStorage['token']
}
@ -101,7 +101,7 @@ export default function Documents({idWell, selectedFileCategory}) {
}
await FileService.getFilesInfo(
`${idWell}`,
`${id}`,
(page - 1) * pageSize,
pageSize,
selectedFileCategory,
@ -126,12 +126,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>