![](/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.