@itutoring/itutoring_application_js_api 1.0.15 → 1.0.16
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 -3
- package/modules/TeacherManager.js +8 -0
- package/objects/Teacher.js +1 -0
- package/package.json +1 -1
package/apiController.js
CHANGED
|
@@ -20,7 +20,7 @@ class APIController
|
|
|
20
20
|
return "https://api.test.itutoring.cz/";
|
|
21
21
|
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
if (this.#R_KEY == R_KEYs.r_key_live)
|
|
25
25
|
{
|
|
26
26
|
return "https://api.itutoring.cz/";
|
|
@@ -85,7 +85,7 @@ class APIController
|
|
|
85
85
|
* @param data "data must be as array - key, value pair. They'll be passed into the request"
|
|
86
86
|
* @returns "Response from server"
|
|
87
87
|
*/
|
|
88
|
-
static async Post(module, method, data)
|
|
88
|
+
static async Post(module, method, data, file = null)
|
|
89
89
|
{
|
|
90
90
|
await APIController.GetLocalRKey();
|
|
91
91
|
await APIController.GetClientKey();
|
|
@@ -110,7 +110,22 @@ class APIController
|
|
|
110
110
|
request.setRequestHeader("sites", location.hostname);
|
|
111
111
|
request.setRequestHeader("key", APIController.#CLIENT_KEY);
|
|
112
112
|
request.setRequestHeader("visitor-session", this.GetVisitorSessionID());
|
|
113
|
-
|
|
113
|
+
|
|
114
|
+
if (file != null)
|
|
115
|
+
{
|
|
116
|
+
var formData = new FormData();
|
|
117
|
+
formData.append("file", file);
|
|
118
|
+
for (const [key, value] of Object.entries(data))
|
|
119
|
+
{
|
|
120
|
+
formData.append(key, value);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
request.send(formData);
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
{
|
|
127
|
+
request.send(args);
|
|
128
|
+
}
|
|
114
129
|
});
|
|
115
130
|
}
|
|
116
131
|
|
|
@@ -12,6 +12,7 @@ class TeacherManager
|
|
|
12
12
|
static #GET_TEACHER_FOR_LESSON = "GetTeacherForLesson";
|
|
13
13
|
static #GET_ALL_TEACHERS = "GetAllTeachers";
|
|
14
14
|
static #UPDATE_SUBJECT_TIMES = "UpdateSubjectTimes";
|
|
15
|
+
static #UPDATE_PHOTO = "UpdatePhoto";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Find and choose available teacher for your time.
|
|
@@ -67,6 +68,13 @@ class TeacherManager
|
|
|
67
68
|
|
|
68
69
|
return APIController.IntToBool(res);
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
static async UpdatePhoto(teacherId, photoFile)
|
|
73
|
+
{
|
|
74
|
+
var res = await APIController.Post(this.#MODULE, this.#UPDATE_PHOTO, {
|
|
75
|
+
"id": teacherId,
|
|
76
|
+
}, photoFile);
|
|
77
|
+
}
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
export default TeacherManager;
|
package/objects/Teacher.js
CHANGED