how to send value to variables same this ? `const...
# prisma-whats-new
k
how to send value to variables same this ?
Copy code
const stageTwoConfig = {
    name: ‘createTeamWork’,
    props: ({
        createTeamWork,
        ownProps: { client }
    }) => ({
        update: (event) => {
            const data = new FormData(event.target)
            event.preventDefault()
            event.stopPropagation()
            createTeamWork({
                variables: {
                    firstName: this.state.firstName,
                    lastName: this.state.lastName,
                    position: this.state.position,
                    experience: this.state.experience,
                    eduBg: this.state.eduBg,
                }
            }).then((res) => {
                console.log(‘res ok’, res)
                // redirect({}, ‘/voucher/form/stage-3’)
            }).catch((error) => {
                console.error(‘error’, error)
            })
        }
    })
}
solution _createTeamWork = () => { this.props.mutate({ variables: { firstName: this.state.firstName, lastName: this.state.lastName, position: this.state.position, experience: this.state.experience, eduBg: this.state.eduBg } }) .then(({ data }) => { console.log(‘got data’, data); }).catch((error) => { console.log(‘there was an error sending the query’, error); }); } <Form onSubmit={this._createTeamWork} >
m
@Kimiiz are you using apollo-client?
or relay?
k
apollo
@Kimiiz let me know if that helps
k
@max thank you.
how to mutation: gql and resolver mutaion for this variables
Copy code
variables: {
                TeamWork: [
                    {
                        firstName: “firstname - 1”,
                        lastName: “lastname - 1",
                        position: “position - 1”,
                        experience: “experience - 1",
                        eduBg: “eduBg - 1”
                    },
                    {
                        firstName: “firstname - 2",
                        lastName: “lastname - 2”,
                        position: “position - 2",
                        experience: “experience - 2”,
                        eduBg: “eduBg - 2"
                    },
                    {
                        firstName: “firstname - 3”,
                        lastName: “lastname - 3",
                        position: “position - 3”,
                        experience: “experience - 3",
                        eduBg: “eduBg - 3”
                    }
                ]
            }