Commit 484c5e17 authored by TJHeeringa's avatar TJHeeringa

Removed explicit SetPreferredProfile call, Closes #64

parent 78fb2273
......@@ -157,8 +157,8 @@ class ProfileFormWithoutContainer extends Component {
postProfile(profile) {
return Helper.api_call(process.env.REACT_APP_API_URL + "/profiles", "POST", profile, 'json',
(data)=>{
this.setPreferredProfile(data, this.props.onSuccess);
this.context.handleAlertHandler('green', 'Save successful');
this.props.onSuccess(data);
},
(data)=>{
this.context.handleAlertHandler('red', 'Save failed');
......@@ -173,14 +173,6 @@ class ProfileFormWithoutContainer extends Component {
);
};
setPreferredProfile(profile, onSuccess) {
// For rendering reasons there is a read only `preferred_profile` and a write only `preferred_profile_2`.
Helper.api_call(process.env.REACT_APP_API_URL + "/sunmembers/me", "PATCH", {'preferred_profile_2': profile.url}, 'json',
(data)=>{onSuccess(profile)},
(data)=>{this.context.handleAlertHandler('red', 'Save failed')},
);
};
render() {
return (
<AvForm id="noprofileyetform" onValidSubmit={this.handleValidSubmit} ref={c => (this.form = c)}>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment