Skip to content

Commit

Permalink
refreshing the component after saving phase data
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunaTebel committed Nov 10, 2019
1 parent 9d95976 commit d36cb7a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/ArchestEditPhaseComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class ArchestEditPhaseComponent extends Component {

componentDidMount() {
const phaseId = this.props.match.params.phaseId;
this.init(phaseId);
}

init(phaseId) {
const requestConfigs = [
{
name: 'phase',
Expand Down Expand Up @@ -71,16 +74,15 @@ class ArchestEditPhaseComponent extends Component {
]
})
});

}

savePhaseData() {
let values = this.state.formValues;
values['resource_ids'] = _.map(values.project_resources, (resource) => parseInt(resource.id, 10));
values['manager_ids'] = _.map(values.project_managers, (manager) => parseInt(manager.id, 10));
console.log(JSON.parse(JSON.stringify(values)));
ArchestHttp.PATCH(`${BACKEND_ESTIMATOR_API_URL}/phases/${this.state.phase.id}/`, values).then((response) => {
console.log(response);
let phase = response.data;
this.init(phase.id);
}).catch((error) => {
console.log(error);
});
Expand Down

0 comments on commit d36cb7a

Please sign in to comment.