@itutoring/itutoring_application_js_api 1.6.24 → 1.6.26

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 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["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
  }
@@ -34,6 +34,15 @@ class TableExplorer
34
34
  static #ADD_FILTER = "AddFilter";
35
35
  static #RESET_FILTER = "ResetFilter";
36
36
  static #SET_SPECIAL_FILTER = "SetSpecialFilter";
37
+ static #REMOVE_FILTER = "RemoveFilter";
38
+
39
+ static async removeFilter(token, filter)
40
+ {
41
+ await APIController.Post(this.#MODULE, this.#REMOVE_FILTER, {
42
+ 'token': token,
43
+ 'filter': filter,
44
+ });
45
+ }
37
46
 
38
47
  static async setSpecialFilter(token, filter)
39
48
  {
@@ -100,7 +109,7 @@ class TableExplorer
100
109
 
101
110
  return data;
102
111
  }
103
-
112
+
104
113
  static async getMaxPages(token)
105
114
  {
106
115
  var data = await APIController.Get(this.#MODULE, this.#GET_MAX_PAGES, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.6.24",
3
+ "version": "1.6.26",
4
4
  "description": "Javascript API for iTutoring Application",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",