UNPKG

apollo-angular

Version:

Use your GraphQL data in your Angular app, with the Apollo Client

1 lines 1.19 kB
{"version":3,"file":"ngApolloLinkHeaders.mjs","sources":["../../headers/src/index.ts","../../headers/src/ngApolloLinkHeaders.ts"],"sourcesContent":["import { HttpHeaders } from '@angular/common/http';\nimport { ApolloLink, NextLink, Operation } from '@apollo/client/core';\n\nexport const httpHeaders = () => {\n return new ApolloLink((operation: Operation, forward: NextLink) => {\n const { getContext, setContext } = operation;\n const context = getContext();\n\n if (context.headers) {\n setContext({\n ...context,\n headers: new HttpHeaders(context.headers),\n });\n }\n\n return forward(operation);\n });\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGO,MAAM,WAAW,GAAG,MAAK;IAC9B,OAAO,IAAI,UAAU,CAAC,CAAC,SAAoB,EAAE,OAAiB,KAAI;AAChE,QAAA,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;AAC7C,QAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAE7B,QAAA,IAAI,OAAO,CAAC,OAAO,EAAE;AACnB,YAAA,UAAU,CAAC;AACT,gBAAA,GAAG,OAAO;AACV,gBAAA,OAAO,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;AAC1C,aAAA,CAAC,CAAC;SACJ;AAED,QAAA,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;AAC5B,KAAC,CAAC,CAAC;AACL;;ACjBA;;AAEG;;;;"}