Rebase, add user feedback
parent
ba7a4b9752
commit
7d339c0bd6
|
@ -15,6 +15,7 @@ export const SourceForm = React.createClass({
|
||||||
redirectPath: PropTypes.string,
|
redirectPath: PropTypes.string,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
addFlashMessage: PropTypes.func.isRequired,
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
|
@ -35,7 +36,7 @@ export const SourceForm = React.createClass({
|
||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const {router} = this.props;
|
const {router, params, addFlashMessage} = this.props;
|
||||||
const newSource = Object.assign({}, this.state.source, {
|
const newSource = Object.assign({}, this.state.source, {
|
||||||
url: this.sourceURL.value,
|
url: this.sourceURL.value,
|
||||||
name: this.sourceName.value,
|
name: this.sourceName.value,
|
||||||
|
@ -45,13 +46,13 @@ export const SourceForm = React.createClass({
|
||||||
});
|
});
|
||||||
if (this.state.editMode) {
|
if (this.state.editMode) {
|
||||||
updateSource(newSource).then(() => {
|
updateSource(newSource).then(() => {
|
||||||
// TODO: use the source.id that comes back from the server, when goller's PR gets merged and the autogenerated code gets banished!
|
router.push(`/sources/${params.sourceID}/manage-sources`);
|
||||||
router.push(`/sources/${1}/manage-sources`);
|
addFlashMessage({type: 'success', text: 'The source was successfully updated'});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
createSource(newSource).then(() => {
|
createSource(newSource).then(() => {
|
||||||
// TODO: use the source.id that comes back from the server, when goller's PR gets merged and the autogenerated code gets banished!
|
router.push(`/sources/${params.sourceID}/manage-sources`);
|
||||||
router.push(`/sources/${1}/manage-sources`);
|
addFlashMessage({type: 'success', text: 'The source was successfully created'});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue