@itutoring/itutoring_application_js_api 1.0.7 → 1.0.9

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/README.md CHANGED
@@ -1 +1,6 @@
1
- # iTutoring_Application_API-js
1
+ # iTutoring Application Javascript API
2
+
3
+ This package contains a javascript API for iTutoring Application.
4
+ In order to use this API you need to obtain an API key.
5
+
6
+ API Documentation for iTutoring Application can be found here: TO BE SOON
package/apiController.js CHANGED
@@ -1,5 +1,5 @@
1
- import CookiesManager from "./CookiesManager";
2
- import {R_KEYs} from "./objects/Enums";
1
+ import CookiesManager from "./CookiesManager";
2
+ import { R_KEYs } from "./objects/Enums";
3
3
 
4
4
  /**
5
5
  * Main class for comunicating with our backend REST api.
@@ -171,25 +171,23 @@ class APIController
171
171
  resolve(APIController.#CLIENT_KEY);
172
172
  }
173
173
 
174
- // For localhost don't use xml config, but automaticly
175
- // return test key.
174
+ let keyPath = '/client_key.xml';
175
+ // For localhost use different xml file (to make suer we won't revwrite the server key when uploading websites)
176
176
  if (location.hostname === "localhost")
177
177
  {
178
- APIController.#CLIENT_KEY = "r5u8x/A?D(G+KbPeShVmYp3s6v9y$B&E";
179
- resolve(APIController.#R_KEY);
178
+ keyPath = '/local_client_key.xml'
180
179
  }
181
- else
180
+
181
+ fetch(keyPath).then(response => response.text()).then((data) =>
182
182
  {
183
- fetch('/client_key.xml').then(response => response.text()).then((data) =>
184
- {
185
- var parser = new DOMParser();
186
- var keyXML = parser.parseFromString(data, "text/xml");
187
- var key = keyXML.getElementsByTagName("key")[0].childNodes[0].nodeValue;
183
+ var parser = new DOMParser();
184
+ var keyXML = parser.parseFromString(data, "text/xml");
185
+ var key = keyXML.getElementsByTagName("key")[0].childNodes[0].nodeValue;
186
+
187
+ APIController.#CLIENT_KEY = key;
188
+ resolve(APIController.#CLIENT_KEY);
189
+ });
188
190
 
189
- APIController.#CLIENT_KEY = key;
190
- resolve(APIController.#CLIENT_KEY);
191
- });
192
- }
193
191
  });
194
192
  }
195
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Javascript API for iTutoring Application",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",