change(ui) - role modify/create fetch list and show feedback msg
This commit is contained in:
parent
165281367b
commit
68ea046919
2 changed files with 7 additions and 3 deletions
|
|
@ -43,7 +43,11 @@ function Roles(props: Props) {
|
||||||
}
|
}
|
||||||
}, [removeErrors])
|
}, [removeErrors])
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = (showToastMessage) => {
|
||||||
|
if (showToastMessage) {
|
||||||
|
toast.success(showToastMessage)
|
||||||
|
props.fetchList()
|
||||||
|
}
|
||||||
setShowmModal(false)
|
setShowmModal(false)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
init()
|
init()
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ interface Props {
|
||||||
role: any,
|
role: any,
|
||||||
edit: (role: any) => void,
|
edit: (role: any) => void,
|
||||||
save: (role: any) => Promise<void>,
|
save: (role: any) => Promise<void>,
|
||||||
closeModal: () => void,
|
closeModal: (toastMessage?: string) => void,
|
||||||
saving: boolean,
|
saving: boolean,
|
||||||
permissions: Array<Permission>[]
|
permissions: Array<Permission>[]
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,7 @@ const RoleForm = ({ role, closeModal, edit, save, saving, permissions }: Props)
|
||||||
let focusElement = useRef<any>(null)
|
let focusElement = useRef<any>(null)
|
||||||
const _save = () => {
|
const _save = () => {
|
||||||
save(role).then(() => {
|
save(role).then(() => {
|
||||||
closeModal()
|
closeModal(role.exists() ? "Role updated" : "Role created");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue