From 03820c4c889a1d81ef44b049ec8ec84fcf611326 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Thu, 12 Aug 2021 10:03:44 +0500 Subject: [PATCH] Fixed get id of current well for Documents' requests --- src/components/Documents.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Documents.jsx b/src/components/Documents.jsx index f6f10b8..a29a7dc 100644 --- a/src/components/Documents.jsx +++ b/src/components/Documents.jsx @@ -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 (