Apollo-link-rest: 不推荐使用:'@rest(path:'包含':'冒号,此格式将在以后的版本中删除

创建于 2018-08-31  ·  2评论  ·  资料来源: apollographql/apollo-link-rest

const restLink = new RestLink({
  uri: 'https://swapi.co/api/',
});

const client = new ApolloClient({
  link: restLink,
  cache: new InMemoryCache(),
});
const Query = gql`
  query luke($id: String!) {
    person(id: $id)
     @rest(type: "Person", path: "people/:id") {
      name
    }
  }
`;

警告:不建议使用:“ @ rest(path:”包含“:”冒号,此格式将在以后的版本中删除

可能是什么问题呢?

[email protected]
[email protected]
[email protected]
[email protected]

question❔

最有用的评论

您将需要更新到新语法来消除该警告:

 @rest(type: "Person", path: "people/:id") {

变成

 @rest(type: "Person", path: "people/{args.id}") {

所有2条评论

您将需要更新到新语法来消除该警告:

 @rest(type: "Person", path: "people/:id") {

变成

 @rest(type: "Person", path: "people/{args.id}") {

好答案@dbryand!

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

dphaener picture dphaener  ·  5评论

genomics-geek picture genomics-geek  ·  3评论

Simply007 picture Simply007  ·  5评论

joemphilips picture joemphilips  ·  6评论

karensg picture karensg  ·  5评论