makeActionHandler теперь ожидает onComplete

This commit is contained in:
Александр Сироткин 2021-12-21 20:35:45 +05:00
parent c12ce68a96
commit d3412492ff
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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,