Hide search when not allowed to read

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-06-17 10:34:25 +02:00 committed by Alexandre Bodin
parent 1a23abf405
commit 96bd475c5a
2 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,8 @@ import styled from 'styled-components';
import { HeaderSearch as Base } from 'strapi-helper-plugin';
const HeaderSearch = styled(Base)`
left: 32.5rem;
left: 32rem;
z-index: 1060;
`;
export default HeaderSearch;

View File

@ -76,13 +76,17 @@ const ListPage = () => {
}, [search, isLoadingForPermissions]);
useEffect(() => {
toggleHeaderSearch({ id: 'Settings.permissions.menu.link.users.label' });
if (canRead) {
toggleHeaderSearch({ id: 'Settings.permissions.menu.link.users.label' });
}
return () => {
toggleHeaderSearch();
if (canRead) {
toggleHeaderSearch();
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [canRead]);
const handleChangeDataToDelete = ids => {
dispatch({