Example #1
0
 handleCompleteChange = () => {
   Relay.Store.update(
     new ChangeTodoStatusMutation({
       id: this.props.todo.id,
       complete: !this.props.todo.complete,
     }),
   );
 }
Example #2
0
 handleDestroyClick = () => {
   Relay.Store.update(
     new DeleteTodoMutation({
       id: this.props.todo.id,
       viewer: this.props.viewer,
     }),
   );
 }
Example #3
0
 onReviseDraft() {
   const revisionContent = this.refs.reviseContent.value;
   Relay.Store.update(
     new ReviseDraftMutation({
       id: this.props.draft.id,
       content: revisionContent,
     })
   );
 }
Example #4
0
 handleRemove = () => {
   const {resource, group} = this.props;
   Relay.Store.update(
     new RemoveResourceFromGroupMutation({
       resource,
       group,
     })
   );
 }
Example #5
0
 handleConfirm = () => {
   const {viewer, user} = this.props;
   Relay.Store.update(
     new AuthenticateViewerMutation({
       viewer: viewer,
       user: user,
     })
   );
 }
  onToggleAllChange = (e) => {
    const { viewer } = this.props;
    const { todos } = viewer;
    const complete = e.target.checked;

    Relay.Store.update(
      new MarkAllTodosMutation({ viewer, todos, complete })
    );
  };
Example #7
0
 _handleCompleteChange = (e) => {
   const complete = e.target.checked;
   Relay.Store.update(
     new ChangeTodoStatusMutation({
       complete,
       todo: this.props.todo,
       viewer: this.props.viewer,
     })
   );
 };
Example #8
0
 _updateRestaurantMutation = (e) => {
   var resto = {
     id: this.props.id,
     [e.currentTarget.id]: e.currentTarget.value
   };
   console.log('restaurantMutation', resto);
   var onFailure = () => console.log('failure');
   var onSuccess = () => console.log('success');
   Relay.Store.update(new UpdateRestaurantMutation({restaurant: resto}), {onFailure, onSuccess});
 };
Example #9
0
  _onClick() {
    let id   = this.refs.newKey.value;
    let value = this.refs.newValue.value;

    Relay.Store.update(
      new SaveKeyMutation({
        item: { id, value },
      })
    );
  }
Example #10
0
 handleAddShip() {
   var name = this.state.shipName;
   Relay.Store.update(
     new AddShipMutation({
       name,
       faction: this.props.factions[this.state.factionId],
     })
   );
   this.setState({shipName: ''});
 }
Example #11
0
 _handleHidingSpotClick(hidingSpot) {
   if (this._isGameOver()) {
     return;
   }
   Relay.Store.update(
     new CheckHidingSpotForTreasureMutation({
       game: this.props.game,
       hidingSpot,
     })
   );
 }
Example #12
0
 handleInputSave = (text) => {
   Relay.Store.update(
     new ChangeTodoTextMutation({
       id: this.props.todo.id,
       text: text,
     }),
   );
   this.setState({
     isEditing: false,
   });
 }
Example #13
0
 _update = (e) => {
   e.stopPropagation();
   var order = {
     id: this.props.order.id,
     restaurantID: this.props.restaurantID
   };
   order[e.currentTarget.id] = !this.props.order[e.currentTarget.id];
   var onFailure = () => console.log('failure');
   var onSuccess = () => console.log('success');
   Relay.Store.update(new UpdateOrderMutation({order: order}), {onFailure, onSuccess});
 };
Example #14
0
File: Main.js Project: bevzuk/react
 handleSubmit = (e) => {
     e.preventDefault();
     Relay.Store.update(
         new CreateLinkMutation({
             title: this.refs.newTitle.value,
             url: this.refs.newUrl.value,
             store: this.props.store
         })
     );
     this.refs.newTitle = "";
     this.refs.newUrl = "";
 }
Example #15
0
 _mutation = (order) => {
   var onFailure = () => {
     console.log('failuuuure!!!');
     order.id = '_' + Math.random().toString(36).substr(2, 9);
   };
   var onSuccess = () => {
     localStorage[this.props.id] = '';
     this.setState({caddy: [], modal: false});
   };
   order.userID = this.props.user.user.userID;
   order.restaurantID = this.props.restaurant.restaurant.id;
   Relay.Store.update(new OrderMutation({order: order}), {onFailure, onSuccess});
 }
Example #16
0
  return new Promise((resolve, reject) => {
    Relay.Store.update(mutation, {
      onSuccess: resolve,
      onFailure: (transaction) => {
        let error = transaction.getError() || new Error('Mutation failed');

        if (!(error instanceof Error)) {
          error = new Error(error);
        }

        reject(error);
      },
    });
  });
Example #17
0
  handleSubmit = () => {
    if (this.props.disabled) {
      console.warn('New user is not ready');
      return;
    }

    const {master, attributes} = this.props;
    const {name} = attributes;

    Relay.Store.update(
      new NewUserMutation({
        master,
        name,
      })
    );

    this.onComplete();
  }
Example #18
0
		  .forEach((edge) => Relay.Store.update(
			new DeleteTodoMutation({
			  id: edge.node.id,
			  viewer: this.props.viewer,
			})
		  ));
Example #19
0
 _handleTextInputSave = (text) => {
   this._setEditMode(false);
   Relay.Store.update(
     new RenameTodoMutation({todo: this.props.todo, text})
   );
 };
Example #20
0
 .forEach((edge) => Relay.Store.update(
   new ChangeTodoStatusMutation({
     id: edge.node.id,
     complete: setTo,
   })
 ));
Example #21
0
 _removeTodo() {
   Relay.Store.update(
     new RemoveTodoMutation({todo: this.props.todo, viewer: this.props.viewer})
   );
 }
Example #22
0
 _logout() {
   const {app} = this.props;
   Relay.Store.update(new LogoutMutation({app}));
 }
Example #23
0
 _handleTextInputSave = (text) => {
   Relay.Store.update(
     new AddTodoMutation({text, viewer: this.props.viewer})
   );
 }