@itutoring/itutoring_application_js_api 1.7.10 → 1.7.11
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/CookiesManager.js +2 -2
- package/apiController.js +14 -10
- package/package.json +1 -1
package/CookiesManager.js
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
class CookiesManager
|
|
11
11
|
{
|
|
12
|
-
static SetCookie(name, value, expiracy)
|
|
12
|
+
static SetCookie(name, value, expiracy, force = false)
|
|
13
13
|
{
|
|
14
|
-
if (this.GetCookie(name) != null)
|
|
14
|
+
if (this.GetCookie(name) != null && !force)
|
|
15
15
|
return;
|
|
16
16
|
|
|
17
17
|
document.cookie = name + "=" + value + "; expires=" + expiracy + ";path=/";
|
package/apiController.js
CHANGED
|
@@ -55,11 +55,20 @@ class APIController
|
|
|
55
55
|
|
|
56
56
|
static async CreateVisitorSession()
|
|
57
57
|
{
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
var id = '';
|
|
59
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
60
|
+
if (urlParams.has("vid"))
|
|
61
|
+
{
|
|
62
|
+
id = urlParams.get("vid");
|
|
63
|
+
CookiesManager.SetCookie("session", id, date.toUTCString(), true);
|
|
64
|
+
}
|
|
65
|
+
else
|
|
66
|
+
{
|
|
67
|
+
id = Date.now();
|
|
68
|
+
const date = new Date();
|
|
69
|
+
date.setTime(date.getTime() + (7 * 24 * 60 * 60 * 1000));
|
|
70
|
+
CookiesManager.SetCookie("session", id, date.toUTCString());
|
|
71
|
+
}
|
|
63
72
|
this.ReadUserSource();
|
|
64
73
|
|
|
65
74
|
var rKey = await this.GetLocalRKey();
|
|
@@ -68,11 +77,6 @@ class APIController
|
|
|
68
77
|
|
|
69
78
|
static GetVisitorSessionID()
|
|
70
79
|
{
|
|
71
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
72
|
-
if (urlParams.has("vid")) {
|
|
73
|
-
return urlParams.get("vid");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
80
|
//console.log(CookiesManager.GetCookie("session"));
|
|
77
81
|
return CookiesManager.GetCookie("session");
|
|
78
82
|
}
|