Repository URL to install this package:
|
Version:
1.4.5 ▾
|
import { from } from '@apollo/client';
import { UploadLinkOptions, createUploadLink } from 'apollo-upload-client';
import type { ApolloLink, RequestHandler } from '@apollo/client';
import { onErrorLink } from './onError';
import { setHeadersLink } from './setHeaders';
// TODO - remove this when the return type is fixed in `@types/apollo-upload-client`
const createUploadLinkWithCorrectType = (options: UploadLinkOptions) =>
createUploadLink(options) as unknown as ApolloLink | RequestHandler;
export const createApolloLink = (options: UploadLinkOptions) =>
from([onErrorLink, setHeadersLink, createUploadLinkWithCorrectType(options)]);