Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const saveData = () => (dispatch, getState) => {
const formData = (getState().form as IFormState).formData;
const userId = (getState().auth as IAuthState).userId;
const formName = (getState().form as IFormState).formName;
dispatch(loadingStart());
return API.put("treehacks", `/users/${userId}/forms/${formName}`, { "body": formData }).then(e => {
dispatch(setData(e, false));
dispatch(loadingEnd());
dispatch(setUserEdited(false));
});
}
updateGoal = () => {
const { goal } = this.state;
return API.put("goals", `/goals/${this.props.match.params.id}`, {
body: {
title: goal.title,
content: goal.content
}
}).then((value: any) => {
this.setState({
isUpdating: false,
redirect: '/'
});
});
}