SHARE
TWEET

Untitled

a guest Jun 18th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. newCivilization(Name: String!, Description: String!): Civilization!
  2.  
  3. type Civilization {
  4.     Id: Int
  5.     Name: String!
  6.     Description: String!
  7. }
  8.      
  9. const CIV_MUT = gql`
  10.       mutation CivilizationAdd($Name: String!, $Description: String!) {
  11.         newCivilization(Name:$Name, Description:$Description) {
  12.           Id
  13.         }
  14.       }`
  15.      
  16. import React, { Component } from 'react'
  17.     import { Mutation } from "react-apollo"
  18.     import { gql } from "apollo-boost"
  19.     import { Button } from 'react-bootstrap'
  20.  
  21.     class CivilizationAdd extends Component {
  22.     const civName = this.props.civ.civName, civDesc = this.props.civ.civDesc
  23.  
  24.     render(){
  25.     return (
  26.       <Mutation mutation={CIV_MUT} variables={{ Name: civName, Description: civDesc }}>
  27.             {(postMutation) => {
  28.               return (
  29.                 <Button onClick={postMutation}>Guardar</Button>
  30.               )
  31.             }
  32.             }
  33.           </Mutation>)
  34.     )
  35.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top