Should not allow creation of version without name (#1261)

This commit is contained in:
SAI SUMANTH KUMAR 2021-10-26 13:07:29 +05:30 committed by GitHub
parent 1efd73d8e2
commit 1cc16506b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,7 @@ class SaveAndPreview extends React.Component {
appId: props.appId,
isLoading: true,
showVersionForm: false,
newVersionName: '',
};
}
@ -38,25 +39,34 @@ class SaveAndPreview extends React.Component {
hideModal = () => {
this.setState({
showModal: false,
showVersionForm: false,
});
};
createVersion = () => {
const newVersionName = this.state.newVersionName;
const appId = this.props.appId;
this.setState({ creatingVersion: true });
appVersionService.create(appId, newVersionName).then(() => {
this.setState({ showVersionForm: false, creatingVersion: false });
toast.success('Version Created', {
if (newVersionName.trim() !== ''){
this.setState({ creatingVersion: true });
appVersionService.create(appId, newVersionName).then(() => {
this.setState({ showVersionForm: false, creatingVersion: false });
toast.success('Version Created', {
hideProgressBar: true,
position: 'top-center',
containerId: this.state.appId,
});
this.fetchVersions();
// eslint-disable-next-line no-undef
this.props.setAppDefinitionFromVersion(version);
});
} else {
toast.error(
'The name of version should not be empty', {
hideProgressBar: true,
position: 'top-center',
containerId: this.state.appId,
});
this.fetchVersions();
// eslint-disable-next-line no-undef
this.props.setAppDefinitionFromVersion(version);
});
}
};
saveVersion = (versionId) => {