Akryum / Akryum/vue-cli-plugin-apollo

Why the type of the link property in ApolloClientConfig is string instead of ApolloLink

Đang mở
#319 2 bình luận 5 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
477
Fork
109
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Question

Why the type of the link property in ApolloClientConfig is String instead of ApolloLink

### Description

I want to use my 'authMiddlewareLink' instead of the default link。
But I got these problems from VSCode

> Type 'ApolloLink' is not assignable to type 'string'.

### Code
```
const authMiddlewareLink = new ApolloLink((operation, forward) => {
const token = getUserToken();
const headers = token ? { 'API-TOKEN': token } : {};
operation.setContext({
headers,
});
return forward(operation);
});

export const { apolloClient } = createApolloClient({
link: authMiddlewareLink,
...defaultOptions,
});
```

### Version
0.21.3

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.