I am trying to pass array of objects to the graphql mutation in react and typescript. My object contain one file insert by user.
const CREAT_SCOPES = gql`
mutation uploadFiles(
$createBy: String!,
$file_name: String!,
$value: Float!,
$file: Upload!
)
{ uploadFiles
(scopedetails:{
createBy: $createBy,
file_name: $file_name,
value: $value,
file: $file }) }`;
For my mutation I need to pass an array of objects,
[{
createBy: $createBy
file_name: $file_name
value: $value,
file: $file},
{
createBy: $createBy
file_name: $file_name
value: $value,
file: $file
}]
I dont know how to change my mutation to accept array of objects.
mutation uploadFiles(
$createBy: String!,
$file_name: String!,
$value: Float!,
$file: Upload!
)
Can I accept array of objects in mutation. Please share a way of doing it.
I am using react with typescript and @apollo/client.
Thanks in advance.