@itutoring/itutoring_application_js_api 1.6.25 → 1.6.27
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 +29 -1
- package/package.json +1 -1
package/apiController.js
CHANGED
|
@@ -25,6 +25,9 @@ class APIController
|
|
|
25
25
|
static onConfimationReceived = null;
|
|
26
26
|
static onWarningReceived = null;
|
|
27
27
|
|
|
28
|
+
static LastCall = null;
|
|
29
|
+
static ConfirmationToken = null;
|
|
30
|
+
|
|
28
31
|
/**
|
|
29
32
|
* R_KEY MUST be loaded before calling this method!
|
|
30
33
|
* @returns Returns appropriate rest url based on current server.
|
|
@@ -79,6 +82,18 @@ class APIController
|
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
static async ConfirmRequest()
|
|
86
|
+
{
|
|
87
|
+
if (this.LastCall === null || this.ConfirmationToken === null)
|
|
88
|
+
return;
|
|
89
|
+
|
|
90
|
+
this.LastCall.data['token'] = this.ConfirmationToken;
|
|
91
|
+
if (this.LastCall.type === "GET")
|
|
92
|
+
return await this.Get(this.LastCall.module, this.LastCall.method, this.LastCall.data);
|
|
93
|
+
else if (this.LastCall.type === "POST")
|
|
94
|
+
return await this.Post(this.LastCall.module, this.LastCall.method, this.LastCall.data);
|
|
95
|
+
}
|
|
96
|
+
|
|
82
97
|
static ResolveResponse(request)
|
|
83
98
|
{
|
|
84
99
|
const json = JSON.parse(request.responseText);
|
|
@@ -93,6 +108,8 @@ class APIController
|
|
|
93
108
|
{
|
|
94
109
|
if (APIController.onConfimationReceived !== null && APIController.onConfimationReceived !== undefined)
|
|
95
110
|
{
|
|
111
|
+
APIController.ConfirmationToken = json.data['conf_request']['token'];
|
|
112
|
+
json.data['conf_request']["confirm"] = this.ConfirmRequest;
|
|
96
113
|
APIController.onConfimationReceived(json.data['conf_request']);
|
|
97
114
|
}
|
|
98
115
|
}
|
|
@@ -161,7 +178,12 @@ class APIController
|
|
|
161
178
|
{
|
|
162
179
|
APICache.Cache(module + method + cacheSuffix, response);
|
|
163
180
|
}
|
|
164
|
-
|
|
181
|
+
APIController.LastCall = {
|
|
182
|
+
"type": "GET",
|
|
183
|
+
"module": module,
|
|
184
|
+
"method": method,
|
|
185
|
+
"data": data,
|
|
186
|
+
}
|
|
165
187
|
resolve(response);
|
|
166
188
|
}
|
|
167
189
|
}
|
|
@@ -220,6 +242,12 @@ class APIController
|
|
|
220
242
|
{
|
|
221
243
|
APICache.Cache(module + method, response);
|
|
222
244
|
}
|
|
245
|
+
APIController.LastCall = {
|
|
246
|
+
"type": "POST",
|
|
247
|
+
"module": module,
|
|
248
|
+
"method": method,
|
|
249
|
+
"data": data,
|
|
250
|
+
}
|
|
223
251
|
resolve(response);
|
|
224
252
|
}
|
|
225
253
|
}
|