@cocreate/users 1.36.8 → 1.36.10
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/CHANGELOG.md +14 -0
- package/package.json +7 -7
- package/src/client.js +18 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.36.10](https://github.com/CoCreate-app/CoCreate-users/compare/v1.36.9...v1.36.10) (2024-04-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* bump cocreate dependencies ([276f652](https://github.com/CoCreate-app/CoCreate-users/commit/276f6524e6905677c3a99469c64e27e7bc56ebd2))
|
|
7
|
+
|
|
8
|
+
## [1.36.9](https://github.com/CoCreate-app/CoCreate-users/compare/v1.36.8...v1.36.9) (2024-04-29)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* check if url is not the same as current prior to applying location.href ([bda51bb](https://github.com/CoCreate-app/CoCreate-users/commit/bda51bb23bc9b3adc19864fcf78c444d1462b781))
|
|
14
|
+
|
|
1
15
|
## [1.36.8](https://github.com/CoCreate-app/CoCreate-users/compare/v1.36.7...v1.36.8) (2024-02-18)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/users",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.10",
|
|
4
4
|
"description": "A simple users component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"users",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"webpack-log": "^3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocreate/actions": "^1.
|
|
62
|
-
"@cocreate/crud-client": "^1.
|
|
63
|
-
"@cocreate/element-prototype": "^1.
|
|
64
|
-
"@cocreate/elements": "^1.
|
|
65
|
-
"@cocreate/local-storage": "^1.
|
|
66
|
-
"@cocreate/render": "^1.
|
|
61
|
+
"@cocreate/actions": "^1.18.1",
|
|
62
|
+
"@cocreate/crud-client": "^1.33.8",
|
|
63
|
+
"@cocreate/element-prototype": "^1.22.2",
|
|
64
|
+
"@cocreate/elements": "^1.35.1",
|
|
65
|
+
"@cocreate/local-storage": "^1.14.3",
|
|
66
|
+
"@cocreate/render": "^1.40.3"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/src/client.js
CHANGED
|
@@ -186,27 +186,31 @@ const CoCreateUser = {
|
|
|
186
186
|
if (data.user_id && data.user_id !== Crud.socket.user_id || data.clientId && data.clientId !== Crud.socket.clientId)
|
|
187
187
|
return
|
|
188
188
|
|
|
189
|
+
let redirectTag
|
|
189
190
|
if (data.userStatus == 'on' || data.userStatus == 'idle') {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (redirectTag) {
|
|
193
|
-
let redirectLink = redirectTag.getAttribute('href');
|
|
194
|
-
if (redirectLink) {
|
|
195
|
-
document.location.href = redirectLink;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
191
|
+
redirectTag = document.querySelector('[session="true"]');
|
|
199
192
|
} else if (data.userStatus == 'off') {
|
|
200
|
-
|
|
193
|
+
redirectTag = document.querySelector('[session="false"]');
|
|
194
|
+
}
|
|
201
195
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
if (redirectTag) {
|
|
197
|
+
let redirectLink = redirectTag.getAttribute('href');
|
|
198
|
+
if (redirectLink) {
|
|
199
|
+
if (data.userStatus == 'off') {
|
|
205
200
|
localStorage.removeItem("user_id");
|
|
206
201
|
localStorage.removeItem("token");
|
|
207
|
-
document.location.href = redirectLink;
|
|
208
202
|
}
|
|
203
|
+
|
|
204
|
+
// Normalize both URLs to compare paths in a uniform way
|
|
205
|
+
const currentPath = new URL(location.href).pathname.replace('/index.html', '/');
|
|
206
|
+
const targetPath = new URL(redirectLink, location.href).pathname.replace('/index.html', '/');
|
|
207
|
+
|
|
208
|
+
if (currentPath !== targetPath) {
|
|
209
|
+
location.href = redirectLink;
|
|
210
|
+
}
|
|
211
|
+
|
|
209
212
|
}
|
|
213
|
+
|
|
210
214
|
}
|
|
211
215
|
|
|
212
216
|
if (data.userStatus) {
|