reactjs - Apollo Graphql mutation with dynamic number of email address -
i have created graphql mutation allows me create staff record.
mutation addnewstaff { createstaff(input: { first_name: "test name" last_name: "lname" nickname: "nname" positionid: 10 divisionid: 6 contact_numbers: [ {number: "66643535"} {number: "876876867"} ] emails: [ {address: "testuser@gmail.com"} {address: "gfdsaasd@gmail.com"} ] office_location: "op" }) { id first_name last_name } }
the result is
{ "data": { "createstaff": { "id": "16", "first_name": "test name", "last_name": "lname" } } }
the emails , contact_numbers dynamic fields meaning staff can have unlimited number of emails , contact numbers(these stored in separate database tables foreign key staff table). writing frontend code project using react , apollo client. confused on how write gql code creating mutation. cant find example on trying accomplish. can guide me on how accomplish this?
Comments
Post a Comment