feat(branch & warehouse): fix EmptyStatus.

This commit is contained in:
elforjani13
2022-03-06 15:11:04 +02:00
parent 94c88a7003
commit 5c52f80536
8 changed files with 71 additions and 27 deletions

View File

@@ -2,7 +2,11 @@ import React from 'react';
import intl from 'react-intl-universal';
import BranchesDataTable from './BranchesDataTable';
import BranchesEmptyStatus from './BranchesEmptyStatus';
import { Choose } from 'components';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import { useBranchesContext } from './BranchesProvider';
import { compose } from 'utils';
@@ -10,10 +14,21 @@ function Branches({
// #withDashboardActions
changePreferencesPageTitle,
}) {
const { isEmptyStatus } = useBranchesContext();
React.useEffect(() => {
changePreferencesPageTitle(intl.get('branches.label'));
}, [changePreferencesPageTitle]);
return <BranchesDataTable />;
return (
<Choose>
<Choose.When condition={isEmptyStatus}>
<BranchesEmptyStatus />
</Choose.When>
<Choose.Otherwise>
<BranchesDataTable />
</Choose.Otherwise>
</Choose>
);
}
export default compose(withDashboardActions)(Branches);