Admin: Update org list after delete (#26277)

This commit is contained in:
Alex Khomenko 2020-07-15 10:35:00 +03:00 committed by GitHub
parent 23e93175d1
commit 208f95a76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ export const AdminListOrgsPages: FC = () => {
const navIndex = useSelector((state: StoreState) => state.navIndex);
const navModel = getNavModel(navIndex, 'global-orgs');
const [state, fetchOrgs] = useAsyncFn(async () => await getOrgs(), []);
useEffect(() => {
fetchOrgs();
}, []);
@ -44,7 +45,7 @@ export const AdminListOrgsPages: FC = () => {
</VerticalGroup>
</InfoBox>
<div className="page-action-bar__spacer"></div>
<div className="page-action-bar__spacer" />
<LinkButton icon="plus" href="org/new">
New org
</LinkButton>
@ -55,8 +56,7 @@ export const AdminListOrgsPages: FC = () => {
<AdminOrgsTable
orgs={state.value}
onDelete={orgId => {
deleteOrg(orgId);
fetchOrgs();
deleteOrg(orgId).then(() => fetchOrgs());
}}
/>
)}