![](/img/trans.png)
[英]RBAC on GraphQL backend using CASL and graphql-shield and sharing rules with my React front-end
[英]GraphQL Front-end React
我创建了变量来接收 GraphQL 申请
const users = gql`
getCompanyById(id: "Jwx7C2RAekf1XZmUf9kX") {
__typename
... on Company {
name
usersConnection(first: 10) {
edges {
node {
id
firstName
lastName
phone
email
cpf
}
}
}
}
}
`;
但是在前端抛出这个错误。
GraphQLError: Syntax Error: Unexpected Name "getCompanyById".
我猜您在 getCompanyById 之前缺少大括号。 尝试这个:
const users = gql` {
getCompanyById(query: {id: "Jwx7C2RAekf1XZmUf9kX"}) {
__typename
... on Company {
name
usersConnection(first: 10) {
edges {
node {
id
firstName
lastName
phone
email
cpf
}
}
}
}
}
} `;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.