From baedbeff65859af859b9ef2f5164c3d00daea312 Mon Sep 17 00:00:00 2001
From: Jonas Leder <jonas.leder@jobrouter.com>
Date: Wed, 16 Mar 2022 11:29:58 +0100
Subject: [PATCH] add graphql

---
 src/app/app.module.ts | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 1772d4d..58e200c 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -2,6 +2,11 @@ import { NgModule } from '@angular/core';
 import { BrowserModule } from '@angular/platform-browser';
 import "@angular/compiler";
 
+import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular';
+import {HttpLink} from 'apollo-angular/http';
+import {HttpClientModule} from '@angular/common/http';
+import {InMemoryCache} from '@apollo/client/core';
+
 import { AppRoutingModule } from './app-routing.module';
 import { AppComponent } from './app.component';
 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@@ -12,6 +17,8 @@ import { MatTableModule } from '@angular/material/table';
 
 import { BestandComponent } from './bestand/bestand.component';
 
+const graphQL = '/api/'; 
+
 @NgModule({
   declarations: [
     AppComponent,
@@ -21,12 +28,27 @@ import { BestandComponent } from './bestand/bestand.component';
     BrowserModule,
     AppRoutingModule,
     BrowserAnimationsModule,
+    HttpClientModule,
+    ApolloModule,
     MatToolbarModule,
     MatIconModule,
     MatTabsModule,
     MatTableModule
   ],
-  providers: [],
-  bootstrap: [AppComponent]
+  providers: [
+    {
+      provide: APOLLO_OPTIONS,
+      useFactory(httpLink: HttpLink) {
+        return {
+          cache: new InMemoryCache(),
+          link: httpLink.create({
+            uri: graphQL,
+          }),
+        };
+      },
+      deps: [HttpLink],
+    },
+  ],
+  bootstrap: [AppComponent],
 })
 export class AppModule { }
-- 
GitLab