@itutoring/itutoring_application_js_api 1.3.34 → 1.3.36
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 +19 -3
- package/package.json +1 -1
package/apiController.js
CHANGED
|
@@ -88,11 +88,19 @@ class APIController
|
|
|
88
88
|
{
|
|
89
89
|
if (request.readyState == 4)
|
|
90
90
|
{
|
|
91
|
-
|
|
91
|
+
var json = JSON.parse(request.responseText);
|
|
92
|
+
if (json.code ==200)
|
|
93
|
+
{
|
|
94
|
+
resolve(json.data);
|
|
95
|
+
}
|
|
96
|
+
if (json.code == 400)
|
|
97
|
+
{
|
|
98
|
+
resolve("Invalid data");
|
|
99
|
+
}
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
96
104
|
request.setRequestHeader("r-key", APIController.#R_KEY);
|
|
97
105
|
request.setRequestHeader("sites", location.hostname);
|
|
98
106
|
request.setRequestHeader("key", APIController.#CLIENT_KEY);
|
|
@@ -135,7 +143,15 @@ class APIController
|
|
|
135
143
|
{
|
|
136
144
|
if (request.readyState == 4)
|
|
137
145
|
{
|
|
138
|
-
|
|
146
|
+
var json = JSON.parse(request.responseText);
|
|
147
|
+
if (json.code ==200)
|
|
148
|
+
{
|
|
149
|
+
resolve(json.data);
|
|
150
|
+
}
|
|
151
|
+
if (json.code == 400)
|
|
152
|
+
{
|
|
153
|
+
resolve("Invalid data");
|
|
154
|
+
}
|
|
139
155
|
}
|
|
140
156
|
}
|
|
141
157
|
|