From d3412492ff6d73fd7533150c413599ea7506533b Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Tue, 21 Dec 2021 20:35:45 +0500 Subject: [PATCH] =?UTF-8?q?makeActionHandler=20=D1=82=D0=B5=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D1=8C=20=D0=BE=D0=B6=D0=B8=D0=B4=D0=B0=D0=B5=D1=82=20onC?= =?UTF-8?q?omplete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table/EditableTable.jsx | 3 ++- src/pages/AdminPanel/PermissionController.jsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Table/EditableTable.jsx b/src/components/Table/EditableTable.jsx index 1d1a2eb..90f06ab 100644 --- a/src/components/Table/EditableTable.jsx +++ b/src/components/Table/EditableTable.jsx @@ -18,7 +18,8 @@ export const makeActionHandler = (action, { service, setLoader, errorMsg, onComp else if (action === 'delete') await service.delete(record.id) } - onComplete?.() + if (onComplete) + await onComplete() }, setLoader, errorMsg diff --git a/src/pages/AdminPanel/PermissionController.jsx b/src/pages/AdminPanel/PermissionController.jsx index 3d9e236..8390a73 100644 --- a/src/pages/AdminPanel/PermissionController.jsx +++ b/src/pages/AdminPanel/PermissionController.jsx @@ -24,7 +24,7 @@ export const PermissionController = () => { const [showLoader, setShowLoader] = useState(false) const [permissions, setPermissions] = useState([]) - const updateTable = () => invokeWebApiWrapperAsync( + const updateTable = async () => invokeWebApiWrapperAsync( async () => { const permission = await AdminPermissionService.getAll() setPermissions(permission ?? []) @@ -33,7 +33,7 @@ export const PermissionController = () => { `Не удалось загрузить список прав` ) - useEffect(updateTable, []) + useEffect(() => updateTable(), []) const handlerProps = { service: AdminPermissionService,