diff --git a/src/pages/Messages.jsx b/src/pages/Messages.jsx index bec750f..76243e2 100644 --- a/src/pages/Messages.jsx +++ b/src/pages/Messages.jsx @@ -1,13 +1,13 @@ import {Table, Select, DatePicker, ConfigProvider, Input} from 'antd'; -import {MessageService} from '../services/api' -import {useState, useEffect} from 'react' -import {useParams} from 'react-router-dom' -import LoaderPortal from '../components/LoaderPortal' -import '../styles/message.css' -import notify from '../components/notify' import locale from "antd/lib/locale/ru_RU"; +import {useState, useEffect} from 'react' import moment from 'moment' +import {MessageService} from '../services/api' +import LoaderPortal from '../components/LoaderPortal' +import notify from '../components/notify' +import '../styles/message.css' + const {Option} = Select const pageSize = 26 const {RangePicker} = DatePicker; @@ -54,8 +54,7 @@ const filterOptions = [ ] // Данные для таблицы -export default function Messages() { - let {id} = useParams() +export default function Messages({idWell}) { const [messages, setMessages] = useState([]) const [pagination, setPagination] = useState(null) const [page, setPage] = useState(1) @@ -90,7 +89,7 @@ export default function Messages() { begin = range[0].toISOString() end = range[1].toISOString() } - let paginatedMessages = await MessageService.getMessage(`${id}`, + let paginatedMessages = await MessageService.getMessages(idWell, (page - 1) * pageSize, pageSize, categories, @@ -98,7 +97,7 @@ export default function Messages() { end, searchString) if (paginatedMessages === null){ - notify(`Данных по скважине "${id}" нет`, 'warning') + notify(`Данных по скважине "${idWell}" нет`, 'warning') setLoader(false) return } @@ -118,12 +117,12 @@ export default function Messages() { } catch (ex) { console.log(ex) - notify(`Не удалось загрузить сообщения по скважине "${id}"`, 'error') + notify(`Не удалось загрузить сообщения по скважине "${idWell}"`, 'error') } setLoader(false) } GetMessages() - }, [id, page, categories, range, searchString]) + }, [idWell, page, categories, range, searchString]) return ( <>