@itutoring/itutoring_application_js_api 1.4.1 → 1.4.3

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
@@ -91,6 +91,11 @@ class APIController
91
91
  var json = JSON.parse(request.responseText);
92
92
  if (json.code ==200)
93
93
  {
94
+ // check for redirect
95
+ if (json.data == "redirect" && json.url != undefined)
96
+ {
97
+ window.location.href = json.url;
98
+ }
94
99
  resolve(json.data);
95
100
  }
96
101
  if (json.code == 400)
@@ -150,6 +155,11 @@ class APIController
150
155
  var json = JSON.parse(request.responseText);
151
156
  if (json.code ==200)
152
157
  {
158
+ // check for redirect
159
+ if (json.data == "redirect" && json.url != undefined)
160
+ {
161
+ window.location.href = json.url;
162
+ }
153
163
  resolve(json.data);
154
164
  }
155
165
  if (json.code == 400)
@@ -14,8 +14,6 @@ class AttendanceManager
14
14
  {
15
15
  var data = await APIController.Get(this.#MODULE, this.#RETRIVE_ALL_EVENTS);
16
16
 
17
- this.CheckForError(data);
18
-
19
17
  data = JSON.parse(data);
20
18
  var events = [];
21
19
  for (const [key, value] of Object.entries(data))
@@ -44,14 +42,11 @@ class AttendanceManager
44
42
  var data = await APIController.Post(this.#MODULE, this.#UPDATE_EVENT, {
45
43
  'event': JSON.stringify(event),
46
44
  });
47
-
48
- this.CheckForError(data);
49
45
  }
50
46
 
51
47
  static async GetEvents()
52
48
  {
53
49
  var data = await APIController.Get(this.#MODULE, this.#GET_EVENTS);
54
- this.CheckForError(data);
55
50
 
56
51
  data = JSON.parse(data);
57
52
  var atEvents = [];
@@ -70,7 +65,6 @@ class AttendanceManager
70
65
  var data = await APIController.Get(this.#MODULE, this.#GET_ATTENDANCE_FROM_EVENT, {
71
66
  "id": id,
72
67
  });
73
- this.CheckForError(data);
74
68
 
75
69
  data = JSON.parse(data);
76
70
  var atEvents = []
@@ -89,15 +83,6 @@ class AttendanceManager
89
83
 
90
84
  return atEvents;
91
85
  }
92
-
93
- static async CheckForError(data)
94
- {
95
- if (data.includes("error: "))
96
- {
97
- data = data.replace("error: ", "");
98
- location.href = data
99
- }
100
- }
101
86
  }
102
87
 
103
88
  export default AttendanceManager;
@@ -24,7 +24,6 @@ class LessonManager
24
24
  "filterOp": filterOp,
25
25
  });
26
26
 
27
- this.CheckForError(events);
28
27
 
29
28
  var eventObjs = [];
30
29
  var eventsJson = JSON.parse(events)
@@ -44,8 +43,6 @@ class LessonManager
44
43
  "search_param": searchParam,
45
44
  });
46
45
 
47
- this.CheckForError(events);
48
-
49
46
  var eventObjs = [];
50
47
  var eventsJson = JSON.parse(events)
51
48
  for (const [key, value] of Object.entries(eventsJson))
@@ -64,7 +61,6 @@ class LessonManager
64
61
  "id": eventId,
65
62
  });
66
63
 
67
- this.CheckForError(data);
68
64
  }
69
65
 
70
66
  static async UpdateEvent(event)
@@ -74,7 +70,6 @@ class LessonManager
74
70
  "event": eventJson,
75
71
  });
76
72
 
77
- this.CheckForError(data);
78
73
  }
79
74
 
80
75
  /**
@@ -86,16 +81,6 @@ class LessonManager
86
81
  'def_time': defaultTimeUnix,
87
82
  });
88
83
 
89
- this.CheckForError(data);
90
- }
91
-
92
- static async CheckForError(data)
93
- {
94
- if (data.includes("error: "))
95
- {
96
- data = data.replace("error: ", "");
97
- location.href = data;
98
- }
99
84
  }
100
85
  }
101
86
 
@@ -128,20 +128,11 @@ class TeacherPortal
128
128
  var teacherArray = JSON.parse(data);
129
129
 
130
130
  var teacher = new Teacher();
131
- teacher.Email = teacherArray['Email'];
132
- teacher.Name = teacherArray['Name'];
133
- teacher.ZoomMeeting = teacherArray['ZoomMeeting'];
134
- teacher.ID = teacherArray['ID'];
135
- teacher.TeachedLessons = teacherArray['TeachedLessons'];
136
- teacher.Admin = teacherArray['Admin'];
137
- teacher.BitmojiURL = decodeURIComponent(teacherArray['BitmojiURL']);
138
-
139
- var teacherProfile = new TeacherProfile();
140
- teacherProfile.Bio = teacherArray['Profile']['Bio'];
141
- teacherProfile.Name = teacherArray['Profile']['Name'];
142
- teacherProfile.PhotoPath = teacherArray['Profile']['PhotoPath'];
143
-
144
- teacher.TeacherProfile = teacherProfile;
131
+ teacher.Email = teacherArray['email'];
132
+ teacher.Name = teacherArray['name'];
133
+ teacher.ZoomMeeting = teacherArray['zoomMeeting'];
134
+ teacher.ID = teacherArray['id'];
135
+ teacher.TeachedLessons = teacherArray['taughtLessons'];
145
136
 
146
137
  return teacher;
147
138
  }
@@ -5,9 +5,6 @@ class Teacher
5
5
  ZoomMeeting;
6
6
  ID;
7
7
  TeachedLessons;
8
- Admin;
9
- BitmojiURL;
10
- TeacherProfile;
11
8
  }
12
9
 
13
10
  export default Teacher;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Javascript API for iTutoring Application",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",