Skip to content

Commit

Permalink
fix(form-builder): make sure apollo is initialized properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Metzener authored and anehx committed Jul 9, 2019
1 parent c66ffa2 commit 8496daa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions addon/components/cfb-form-editor/question/validation.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import Component from "@ember/component";
import { computed } from "@ember/object";
import { inject as service } from "@ember/service";
import { task } from "ember-concurrency";
import layout from "../../../templates/components/cfb-form-editor/question/validation";
import { ComponentQueryManager } from "ember-apollo-client";
import allFormatValidatorsQuery from "ember-caluma/gql/queries/all-format-validators";

export default Component.extend({
export default Component.extend(ComponentQueryManager, {
layout,

apollo: service(),

init() {
this._super(...arguments);

Expand Down
12 changes: 6 additions & 6 deletions addon/services/validator.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Service from "@ember/service";
import { task } from "ember-concurrency";
import { inject as service } from "@ember/service";
import allFormatValidatorsQuery from "ember-caluma/gql/queries/all-format-validators";
import { computed } from "@ember/object";
import { assert } from "@ember/debug";
import { ObjectQueryManager } from "ember-apollo-client";
import { next } from "@ember/runloop";

export default Service.extend({
apollo: service(),

export default Service.extend(ObjectQueryManager, {
init() {
this._super(...arguments);
this._fetchValidators.perform();

next(this._fetchValidators, "perform");
},

/**
Expand Down Expand Up @@ -42,7 +42,7 @@ export default Service.extend({
},

_fetchValidators: task(function*() {
return yield this.get("apollo").query(
return yield this.apollo.query(
{ query: allFormatValidatorsQuery },
"allFormatValidators.edges"
);
Expand Down

0 comments on commit 8496daa

Please sign in to comment.