Hide logs

This commit is contained in:
Ivan Diaz 2018-11-29 14:20:40 -03:00
parent e47df8e6dc
commit e8365fc24e
5 changed files with 7 additions and 5 deletions

View File

@ -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",

View File

@ -2,3 +2,4 @@ opensupports_version = '4.3.2';
root = 'http://localhost:3000';
apiRoot = 'http://localhost:3000/api';
globalIndexPath = '';
showLogs = true;

View File

@ -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();

View File

@ -23,6 +23,7 @@
root = "<?=$url ?>";
apiRoot = '<?=$url ?>/api';
globalIndexPath = "<?=$path ?>";
showLogs = false;
</script>
<?php if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)): ?>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=String.prototype.startsWith,Array.from,Array.prototype.fill,Array.prototype.keys,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes,String.prototype.repeat,Number.isInteger,Promise&flags=gated"></script>

View File

@ -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',