aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-03-18 16:37:21 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-03-18 16:37:21 +0100
commit88faef416eadc891537f03926160e35245125c72 (patch)
treedb97bb469dcda8fb32a52b2c859b3b9988ad3cc5 /src/stores
parentfix(Service Tabs): Remove "delete service" context menu when not in developme... (diff)
downloadferdium-app-88faef416eadc891537f03926160e35245125c72.tar.gz
ferdium-app-88faef416eadc891537f03926160e35245125c72.tar.zst
ferdium-app-88faef416eadc891537f03926160e35245125c72.zip
Replace console logs with debugger
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 c38d0d9ee..0d9ff7f9b 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');
@@ -103,7 +105,7 @@ export default class ServicesStore extends Store {
103 return activeService; 105 return activeService;
104 } 106 }
105 107
106 console.warn('Service not available'); 108 debug('Service not available');
107 } 109 }
108 110
109 return null; 111 return null;
@@ -117,10 +119,10 @@ export default class ServicesStore extends Store {
117 const recipesStore = this.stores.recipes; 119 const recipesStore = this.stores.recipes;
118 120
119 if (recipesStore.isInstalled(recipeId)) { 121 if (recipesStore.isInstalled(recipeId)) {
120 console.debug('Recipe is installed'); 122 debug(`Recipe ${recipeId} is installed`);
121 this._redirectToAddServiceRoute(recipeId); 123 this._redirectToAddServiceRoute(recipeId);
122 } else { 124 } else {
123 console.warn('Recipe is not installed'); 125 debug(`Recipe ${recipeId} is not installed`);
124 // We access the RecipeStore action directly 126 // We access the RecipeStore action directly
125 // returns Promise instead of action 127 // returns Promise instead of action
126 await this.stores.recipes._install({ recipeId }); 128 await this.stores.recipes._install({ recipeId });
@@ -487,7 +489,7 @@ export default class ServicesStore extends Store {
487 if (service) { 489 if (service) {
488 service.webview.openDevTools(); 490 service.webview.openDevTools();
489 } else { 491 } else {
490 console.warn('No service is active'); 492 debug('No service is active');
491 } 493 }
492 } 494 }
493 495