我有一个运行有GraphQL后端的Vue.js应用程序,而Gridsome是Vue.js样板生成器。
我正在尝试编写GraphQL查询以仅返回已登录用户的数据,如下所示:
query Blah($test: String!) {
db {
settings (where: {user_id: {_eq: $test}})
{
key
value
}
}
其中定义了$ test变量:
export default {
data() {
return {
test: "Va123",
user: null
};
}
}
但是我收到此错误消息:
An error occurred while executing query for src/pages/Profile.vue
Error: Variable "$test" of required type "String!" was not provided.
这是给page, not a template带来麻烦的