@itutoring/itutoring_application_js_api 1.4.26 → 1.4.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apiController.js +18 -5
- package/package.json +1 -1
package/apiController.js
CHANGED
|
@@ -11,6 +11,8 @@ class APIController
|
|
|
11
11
|
|
|
12
12
|
static UserSource = null;
|
|
13
13
|
|
|
14
|
+
static onErrorReceived = null
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* R_KEY MUST be loaded before calling this method!
|
|
16
18
|
* @returns Returns apropriate rest url based on current server.
|
|
@@ -94,7 +96,8 @@ class APIController
|
|
|
94
96
|
// check for redirect
|
|
95
97
|
if (json.data == "redirect" && json.url != undefined)
|
|
96
98
|
{
|
|
97
|
-
|
|
99
|
+
alert(json.url);
|
|
100
|
+
window.location.href = decodeURI(json.url);
|
|
98
101
|
}
|
|
99
102
|
resolve(json.data);
|
|
100
103
|
}
|
|
@@ -104,13 +107,18 @@ class APIController
|
|
|
104
107
|
console.log("Error: " + json.error_message);
|
|
105
108
|
console.log("ErrorCode: " + json.error_code);
|
|
106
109
|
console.log("StackTrace: " + json.stack_trace);
|
|
107
|
-
|
|
110
|
+
var error = {
|
|
108
111
|
error: {
|
|
109
112
|
message: json.error_message,
|
|
110
113
|
code: json.error_code,
|
|
111
114
|
stackTrace: json.stack_trace
|
|
112
115
|
}
|
|
113
|
-
}
|
|
116
|
+
};
|
|
117
|
+
resolve(JSON.stringify(error));
|
|
118
|
+
if (APIController.onErrorReceived != null)
|
|
119
|
+
{
|
|
120
|
+
APIController.onErrorReceived(error);
|
|
121
|
+
}
|
|
114
122
|
}
|
|
115
123
|
}
|
|
116
124
|
}
|
|
@@ -174,13 +182,18 @@ class APIController
|
|
|
174
182
|
console.log("Error: " + json.error_message);
|
|
175
183
|
console.log("ErrorCode: " + json.error_code);
|
|
176
184
|
console.log("StackTrace: " + json.stack_trace);
|
|
177
|
-
|
|
185
|
+
var error = {
|
|
178
186
|
error: {
|
|
179
187
|
message: json.error_message,
|
|
180
188
|
code: json.error_code,
|
|
181
189
|
stackTrace: json.stack_trace
|
|
182
190
|
}
|
|
183
|
-
}
|
|
191
|
+
};
|
|
192
|
+
resolve(JSON.stringify(error));
|
|
193
|
+
if (APIController.onErrorReceived != null)
|
|
194
|
+
{
|
|
195
|
+
APIController.onErrorReceived(error);
|
|
196
|
+
}
|
|
184
197
|
}
|
|
185
198
|
}
|
|
186
199
|
}
|