How to use the @aws-amplify/api.put function in @aws-amplify/api

To help you get started, we’ve selected a few @aws-amplify/api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TreeHacks / root / src / store / form / actions.ts View on Github external
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));
  });
}
github awslabs / aws-full-stack-template / assets / src / modules / goal / AddEditGoal.tsx View on Github external
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: '/'
      });
    });
  }