Commit eb589c00 authored by RAHUL RATHORE's avatar RAHUL RATHORE
Browse files

fix: apollo configuration for merchant-tablet-ionic

parent 12927074
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -136,15 +136,7 @@
		<ion-row>
			<ion-col>
				<ion-button
					[disabled]="
						hasChanges(
							paymentsSettings.isValid,
							productsDelivery.dirty,
							productsTakeaway.dirty,
							orderBarcodeType.dirty,
							barcodeData.dirty
						)
					"
					[disabled]="hasChanges()"
					class="save-button"
					(click)="saveChanges()"
					color="success"
+1 −1
Original line number Diff line number Diff line
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
import { Component, Input, AfterViewInit } from '@angular/core';
import Warehouse from '@modules/server.common/entities/Warehouse';
import OrderBarcodeTypes, {
	orderBarcodeTypesToString,
+7 −8
Original line number Diff line number Diff line
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { Apollo } from 'apollo-angular';
import { HttpLink, HttpLinkModule } from 'apollo-angular-link-http';
import { InMemoryCache } from '@apollo/client/core';
import { setContext } from 'apollo-link-context';
import { HttpLink, HttpLinkHandler } from 'apollo-angular/http';
import { ApolloLink, InMemoryCache } from '@apollo/client/core';
import { setContext } from '@apollo/client/link/context';
import { Store } from '../services/store.service';
import { environment } from '../environments/environment';

@NgModule({
	exports: [
		HttpClientModule,
		HttpLinkModule
	],
		HttpClientModule
	]
})
export class GraphQLModule {
	constructor(
@@ -20,9 +19,9 @@ export class GraphQLModule {
		private readonly store: Store
	) {
		const uri = environment.GQL_ENDPOINT;
		const http = httpLink.create({ uri });
		const http: HttpLinkHandler = httpLink.create({ uri });

		const authLink = setContext((_, { headers }) => {
		const authLink: ApolloLink = setContext((_, { headers }) => {
			// get the authentication token from local storage if it exists
			const token = store.token;
			// return the headers to the context so httpLink can read them
+10 −7
Original line number Diff line number Diff line
@@ -41,9 +41,9 @@ import { AppModuleGuard } from './app.module.guard';
import { MaintenanceModuleGuard } from './+maintenance-info/maintenance-info.module.guard';
import { GoogleMapsLoader } from '@modules/client.common.angular2/services/googleMapsLoader';
import { Apollo } from 'apollo-angular';
import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';
import { InMemoryCache } from '@apollo/client/core';
import { setContext } from 'apollo-link-context';
import { HttpLink, HttpLinkHandler } from 'apollo-angular/http';
import { ApolloLink, InMemoryCache } from '@apollo/client/core';
import { setContext } from '@apollo/client/link/context';
import { Store } from './services/store';
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
@@ -153,7 +153,6 @@ const APP_PROVIDERS = [
		}),
		BrowserAnimationsModule,
		FormsModule,
		HttpLinkModule,
		RouterModule.forRoot(ROUTES, {
			useHash: Boolean(history.pushState) === false,
			// enableTracing: true,
@@ -190,12 +189,16 @@ const APP_PROVIDERS = [
	],
})
export class AppModule {
	constructor(apollo: Apollo, httpLink: HttpLink, store: Store) {
		const http = httpLink.create({
	constructor(
		private readonly apollo: Apollo,
		private readonly httpLink: HttpLink,
		private readonly store: Store
	) {
		const http: HttpLinkHandler = httpLink.create({
			uri: environment.GQL_ENDPOINT,
		});

		const authLink = setContext((_, { headers }) => {
		const authLink: ApolloLink = setContext((_, { headers }) => {
			// get the authentication token from local storage if it exists
			const token = store.token;
			// return the headers to the context so httpLink can read them