Skip to content

Commit

Permalink
Fixed bug in query service.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Imolorhe committed Nov 13, 2017
1 parent f637204 commit 67652c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/services/query.service.ts
Expand Up @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';

import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';

import * as fromRoot from '../reducers';

Expand All @@ -18,23 +19,23 @@ export class QueryService {
private store: Store<fromRoot.State>
) { }

loadUrl(windowId): Observable<any> {
loadUrl(windowId): Subscription {
return this.db.getItem(`${windowId}:url`).subscribe(url => {
if (url) {
this.store.dispatch(new queryActions.SetUrlFromDbAction(url, windowId));
}
});
}

loadQuery(windowId): Observable<any> {
loadQuery(windowId): Subscription {
return this.db.getItem(`${windowId}:query`).subscribe(query => {
if (query) {
this.store.dispatch(new queryActions.SetQueryFromDbAction(query, windowId));
}
});
}

loadIntrospection(windowId): Observable<any> {
loadIntrospection(windowId): Subscription {
return this.db.getItem(`${windowId}:introspection`).subscribe(introspectionData => {
if (introspectionData) {
this.store.dispatch(new gqlSchemaActions.SetIntrospectionFromDbAction(introspectionData, windowId));
Expand Down

0 comments on commit 67652c7

Please sign in to comment.