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

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -