Redirect away from forms when dependencies not met

This commit is contained in:
James Nuanez committed 2020-04-22 14:56:15 -07:00
1 parent 7ab0aa7c2a
commit 838611607a
2 files changed
+34

No files matched your search

+10
View File
@@ -115,6 +115,16 @@ const ApplicationForm = props => {
setAccounts(accounts);
setApplications(applications);
if (accounts.length === 0) {
history.push('/internal/accounts');
dispatch({
type: 'ADD',
level: 'error',
message: 'You must create an account before you can create an application.',
});
return;
}
if (
(props.type === 'setup' && accounts.length > 1) ||
(props.type === 'setup' && applications.length > 1)