Akryum / Akryum/vue-cli-plugin-apollo

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

Abierto
#319 2 comentarios 5 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
477
Forks
109
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.