aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/RecipesStore.js8
-rw-r--r--src/stores/RequestStore.js4
-rw-r--r--src/stores/ServicesStore.js10
3 files changed, 13 insertions, 9 deletions
diff --git a/src/stores/RecipesStore.js b/src/stores/RecipesStore.js
index 67fee1d50..a24308f6a 100644
--- a/src/stores/RecipesStore.js
+++ b/src/stores/RecipesStore.js
@@ -5,6 +5,8 @@ import CachedRequest from './lib/CachedRequest';
5import Request from './lib/Request'; 5import Request from './lib/Request';
6import { matchRoute } from '../helpers/routing-helpers'; 6import { matchRoute } from '../helpers/routing-helpers';
7 7
8const debug = require('debug')('RecipeStore');
9
8export default class RecipesStore extends Store { 10export default class RecipesStore extends Store {
9 @observable allRecipesRequest = new CachedRequest(this.api.recipes, 'all'); 11 @observable allRecipesRequest = new CachedRequest(this.api.recipes, 'all');
10 @observable installRecipeRequest = new Request(this.api.recipes, 'install'); 12 @observable installRecipeRequest = new Request(this.api.recipes, 'install');
@@ -34,7 +36,7 @@ export default class RecipesStore extends Store {
34 return activeRecipe; 36 return activeRecipe;
35 } 37 }
36 38
37 console.warn('Recipe not installed'); 39 debug(`Recipe ${match.id} not installed`);
38 } 40 }
39 41
40 return null; 42 return null;
@@ -54,10 +56,8 @@ export default class RecipesStore extends Store {
54 56
55 // Actions 57 // Actions
56 @action async _install({ recipeId }) { 58 @action async _install({ recipeId }) {
57 // console.log(this.installRecipeRequest._promise);
58 const recipe = await this.installRecipeRequest.execute(recipeId)._promise; 59 const recipe = await this.installRecipeRequest.execute(recipeId)._promise;
59 await this.allRecipesRequest.invalidate({ immediately: true })._promise; 60 await this.allRecipesRequest.invalidate({ immediately: true })._promise;
60 // console.log(this.installRecipeRequest._promise);
61 61
62 return recipe; 62 return recipe;
63 } 63 }
@@ -67,7 +67,7 @@ export default class RecipesStore extends Store {
67 const recipes = {}; 67 const recipes = {};
68 68
69 // Hackfix, reference this.all to fetch services 69 // Hackfix, reference this.all to fetch services
70 console.debug(`Check Recipe updates for ${this.all.map(recipe => recipe.id)}`); 70 debug(`Check Recipe updates for ${this.all.map(recipe => recipe.id)}`);
71 71
72 recipeIds.forEach((r) => { 72 recipeIds.forEach((r) => {
73 const recipe = this.one(r); 73 const recipe = this.one(r);
diff --git a/src/stores/RequestStore.js b/src/stores/RequestStore.js
index 4140ca362..595852583 100644
--- a/src/stores/RequestStore.js
+++ b/src/stores/RequestStore.js
@@ -2,6 +2,8 @@ import { action, computed, observable } from 'mobx';
2 2
3import Store from './lib/Store'; 3import Store from './lib/Store';
4 4
5const debug = require('debug')('RequestsStore');
6
5export default class RequestStore extends Store { 7export default class RequestStore extends Store {
6 @observable userInfoRequest; 8 @observable userInfoRequest;
7 @observable servicesRequest; 9 @observable servicesRequest;
@@ -52,7 +54,7 @@ export default class RequestStore extends Store {
52 } 54 }
53 55
54 this._autoRetry(); 56 this._autoRetry();
55 console.debug(`Retry required requests delayed in ${(delay) / 1000}s`); 57 debug(`Retry required requests delayed in ${(delay) / 1000}s`);
56 }, delay); 58 }, delay);
57 } 59 }
58 } 60 }
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index c2dbff55d..f7d92b1ff 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -10,6 +10,8 @@ import CachedRequest from './lib/CachedRequest';
10import { matchRoute } from '../helpers/routing-helpers'; 10import { matchRoute } from '../helpers/routing-helpers';
11import { gaEvent } from '../lib/analytics'; 11import { gaEvent } from '../lib/analytics';
12 12
13const debug = require('debug')('ServiceStore');
14
13export default class ServicesStore extends Store { 15export default class ServicesStore extends Store {
14 @observable allServicesRequest = new CachedRequest(this.api.services, 'all'); 16 @observable allServicesRequest = new CachedRequest(this.api.services, 'all');
15 @observable createServiceRequest = new Request(this.api.services, 'create'); 17 @observable createServiceRequest = new Request(this.api.services, 'create');
@@ -109,7 +111,7 @@ export default class ServicesStore extends Store {
109 return activeService; 111 return activeService;
110 } 112 }
111 113
112 console.warn('Service not available'); 114 debug('Service not available');
113 } 115 }
114 116
115 return null; 117 return null;
@@ -123,10 +125,10 @@ export default class ServicesStore extends Store {
123 const recipesStore = this.stores.recipes; 125 const recipesStore = this.stores.recipes;
124 126
125 if (recipesStore.isInstalled(recipeId)) { 127 if (recipesStore.isInstalled(recipeId)) {
126 console.debug('Recipe is installed'); 128 debug(`Recipe ${recipeId} is installed`);
127 this._redirectToAddServiceRoute(recipeId); 129 this._redirectToAddServiceRoute(recipeId);
128 } else { 130 } else {
129 console.warn('Recipe is not installed'); 131 debug(`Recipe ${recipeId} is not installed`);
130 // We access the RecipeStore action directly 132 // We access the RecipeStore action directly
131 // returns Promise instead of action 133 // returns Promise instead of action
132 await this.stores.recipes._install({ recipeId }); 134 await this.stores.recipes._install({ recipeId });
@@ -493,7 +495,7 @@ export default class ServicesStore extends Store {
493 if (service) { 495 if (service) {
494 service.webview.openDevTools(); 496 service.webview.openDevTools();
495 } else { 497 } else {
496 console.warn('No service is active'); 498 debug('No service is active');
497 } 499 }
498 } 500 }
499 501