Skip to content

Instantly share code, notes, and snippets.

@roytouw7
Created December 10, 2020 18:37
Show Gist options
  • Save roytouw7/f7f084b6bcde7d948d481606453e5631 to your computer and use it in GitHub Desktop.
Save roytouw7/f7f084b6bcde7d948d481606453e5631 to your computer and use it in GitHub Desktop.
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { environment } from 'src/environments/environment';
import { ApolloBoost, ApolloBoostModule } from 'apollo-angular-boost';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [],
imports: [CommonModule],
exports: [HttpClientModule, ApolloBoostModule],
})
export class GraphqlModule {
constructor(apolloBoost: ApolloBoost) {
apolloBoost.create({
uri: environment.FAUNA_ENDPOINT,
request: async (operation) => {
const token = '';
operation.setContext({
headers: {
Authorization: `Bearer ${environment.FAUNA_KEY}`,
},
});
},
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment