Commit 4bcebd29 authored by Sonja Happ's avatar Sonja Happ

remove logging

parent c7937486
......@@ -37,7 +37,7 @@ const REQUEST_TIMEOUT_NOTIFICATION = {
level: 'error'
};
// Check if the error was due to network failure, timeouts, etc.
// Check if the error was due to network failure, timeouts, etc.
// Can be used for the rest of requests
function isNetworkError(err) {
let result = false;
......@@ -45,7 +45,7 @@ function isNetworkError(err) {
// If not status nor response fields, it is a network error. TODO: Handle timeouts
if (err.status == null || err.response == null) {
result = true;
let notification = err.timeout? REQUEST_TIMEOUT_NOTIFICATION : SERVER_NOT_REACHABLE_NOTIFICATION;
NotificationsDataManager.addNotification(notification);
}
......@@ -54,7 +54,6 @@ function isNetworkError(err) {
class RestAPI {
get(url, token) {
console.log(url);
return new Promise(function (resolve, reject) {
var req = request.get(url);
......@@ -74,14 +73,13 @@ class RestAPI {
}
post(url, body, token) {
console.log(url);
return new Promise(function (resolve, reject) {
var req = request.post(url).send(body).timeout({ response: 5000 }); // Simple response start timeout (3s)
if (token != null) {
req.set('Authorization', "Bearer " + token);
}
req.end(function (error, res) {
if (res == null || res.status !== 200) {
......
......@@ -79,30 +79,30 @@ class ArrayStore extends ReduceStore {
case this.type + '/loaded':
if (Array.isArray(action.data)) {
console.log(" loaded Array: ");
console.log(action.data);
console.log(state);
console.log("####### loaded array of type " + this.type);
//console.log(action.data);
//console.log(state);
return this.updateElements(state, action.data);
} else {
console.log("loaded single object: ");
console.log([action.data]);
console.log(state);
console.log("####### loaded single object of type " + this.type);
//console.log([action.data]);
//console.log(state);
return this.updateElements(state, [action.data]);
}
case this.type + '/load-error':
if (action.error && !action.error.handled && action.error.response) {
const USER_LOAD_ERROR_NOTIFICATION = {
title: 'Failed to load',
message: action.error.response.body.message,
level: 'error'
};
NotificationsDataManager.addNotification(USER_LOAD_ERROR_NOTIFICATION);
}
return super.reduce(state, action);
case this.type + '/start-add':
this.dataManager.add(action.data, action.token,action.param);
return state;
......@@ -111,7 +111,7 @@ class ArrayStore extends ReduceStore {
return this.updateElements(state, [action.data]);
case this.type + '/add-error':
return state;
......@@ -133,10 +133,10 @@ class ArrayStore extends ReduceStore {
level: 'error'
};
NotificationsDataManager.addNotification(USER_REMOVE_ERROR_NOTIFICATION);
}
return super.reduce(state, action);
case this.type + '/start-edit':
this.dataManager.update(action.data, action.token,action.param);
return state;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment