我不知道如何在 vue-apollo 中传递这个 curl 请求的 --user 字段
curl -v \
--user 'user@domain.com:password' \
-X POST \
-H "Content-Type: application/json" \
--data '{ "query": "{ companies{ uid name url }}" }' \
http://localhost:4000/graphql
我可以在 vue-apollo 的哪个位置设置 --user ?
我在 vue-apollo 选项对象中尝试过以下
const defaultOptions = {
// You can use `https` for secure connection (recommended in production)
httpEndpoint,
wsEndpoint: null,
persisting: false,
websocketsOnly: false,
ssr: false,
getAuth: () => `Basic user@domain.com:password`
};
但它不起作用
我期待公司的结果
{
"data": {
"companies": [
{
"id": "someId",
"name": "Facebook",
"url": "facebook.com"
},
{
"id": "someId",
"name": "Twitter",
"url": "twitter.com"
}
]
}
}