change(ui) - role modify/create fetch list and show feedback msg

This commit is contained in:
Shekar Siri 2021-12-08 16:13:23 +05:30
parent 165281367b
commit 68ea046919
2 changed files with 7 additions and 3 deletions

View file

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

View file

@ -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");
}) })
} }