From e8365fc24ec88e99078c86dc9d2ab7e537bb0492 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Thu, 29 Nov 2018 14:20:40 -0300 Subject: [PATCH] Hide logs --- client/package.json | 2 +- client/src/config.js | 1 + client/src/index.js | 2 +- client/src/index.php | 1 + client/src/lib-app/api-call.js | 6 +++--- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/package.json b/client/package.json index a0f03980..0faea166 100644 --- a/client/package.json +++ b/client/package.json @@ -38,7 +38,7 @@ "gulp-rename": "^1.2.2", "gulp-sass": "^4.0.1", "gulp-sass-bulk-import": "^1.0.1", - "gulp-sourcemaps": "^1.5.2", + "gulp-sourcemaps": "^2.6.4", "gulp-streamify": "0.0.5", "gulp-uglify": "^2.1.2", "gulp-util": "^3.0.6", diff --git a/client/src/config.js b/client/src/config.js index 3b845300..a767b1a3 100644 --- a/client/src/config.js +++ b/client/src/config.js @@ -2,3 +2,4 @@ opensupports_version = '4.3.2'; root = 'http://localhost:3000'; apiRoot = 'http://localhost:3000/api'; globalIndexPath = ''; +showLogs = true; diff --git a/client/src/index.js b/client/src/index.js index aed4693b..3cca2e29 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -29,7 +29,7 @@ let renderApplication = function () { window.store = store; let unsubscribe = store.subscribe(() => { - console.log(store.getState()); + if(showLogs) console.log(store.getState()); if (store.getState().session.initDone && store.getState().config.initDone) { unsubscribe(); diff --git a/client/src/index.php b/client/src/index.php index d9747b4b..c74539dc 100755 --- a/client/src/index.php +++ b/client/src/index.php @@ -23,6 +23,7 @@ root = ""; apiRoot = '/api'; globalIndexPath = ""; + showLogs = false; diff --git a/client/src/lib-app/api-call.js b/client/src/lib-app/api-call.js index f19920a8..bdaec7b3 100644 --- a/client/src/lib-app/api-call.js +++ b/client/src/lib-app/api-call.js @@ -26,11 +26,11 @@ function processData (data, dataAsForm = false) { module.exports = { call: function ({path, data, plain, dataAsForm}) { - console.log('request ' + path, data); + if(showLogs) console.log('request ' + path, data); return new Promise(function (resolve, reject) { APIUtils.post(apiRoot + path, processData(data, dataAsForm), dataAsForm) .then(function (result) { - console.log(result); + if(showLogs) console.log(result); if (plain || result.status === 'success') { resolve(result); @@ -39,7 +39,7 @@ module.exports = { } }) .catch(function (result) { - console.log('INVALID REQUEST'); + console.log('INVALID REQUEST to: ' + path); console.log(result); reject({ status: 'fail',