add validation to the MetaDetails load action

This commit is contained in:
nklhrstv 2020-03-29 18:32:17 +03:00
parent 0d0717b862
commit 93c11fd7be

View file

@ -32,6 +32,7 @@ const mapMetaDetailsState = (meta_details) => {
const useMetaDetails = (urlParams) => {
const loadMetaDetailsAction = React.useMemo(() => {
if (typeof urlParams.type === 'string' && typeof urlParams.id === 'string') {
return {
action: 'Load',
args: {
@ -55,6 +56,11 @@ const useMetaDetails = (urlParams) => {
}
}
};
} else {
return {
action: 'Unload'
};
}
}, [urlParams]);
return useModelState({
model: 'meta_details',