From 0a1af2c293330cd76ed84bd82abb3eb26f3baa77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Fri, 13 Aug 2021 10:30:26 +0500 Subject: [PATCH] fix webApiClient method name --- src/pages/Messages.jsx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) 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 ( <>