@cocreate/users 1.15.5 → 1.16.0
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 -6
- package/src/client.js +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.16.0](https://github.com/CoCreate-app/CoCreate-users/compare/v1.15.6...v1.16.0) (2023-01-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* import @cocreate/local-storage ([c49ce25](https://github.com/CoCreate-app/CoCreate-users/commit/c49ce2512a673aaec1e3ad6f5c68b6896aa0c1d9))
|
|
7
|
+
|
|
8
|
+
## [1.15.6](https://github.com/CoCreate-app/CoCreate-users/compare/v1.15.5...v1.15.6) (2023-01-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* bump dependencies ([7770274](https://github.com/CoCreate-app/CoCreate-users/commit/7770274a283ead18ccce7f45e96c4f13fd145436))
|
|
14
|
+
|
|
1
15
|
## [1.15.5](https://github.com/CoCreate-app/CoCreate-users/compare/v1.15.4...v1.15.5) (2023-01-13)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/users",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
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",
|
|
@@ -60,10 +60,11 @@
|
|
|
60
60
|
"webpack-log": "^3.0.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@cocreate/actions": "^1.5.
|
|
64
|
-
"@cocreate/crud-client": "^1.
|
|
65
|
-
"@cocreate/docs": "^1.5.
|
|
66
|
-
"@cocreate/element-prototype": "^1.4.
|
|
67
|
-
"@cocreate/
|
|
63
|
+
"@cocreate/actions": "^1.5.55",
|
|
64
|
+
"@cocreate/crud-client": "^1.18.0",
|
|
65
|
+
"@cocreate/docs": "^1.5.9",
|
|
66
|
+
"@cocreate/element-prototype": "^1.4.6",
|
|
67
|
+
"@cocreate/local-storage": "^1.3.49",
|
|
68
|
+
"@cocreate/render": "^1.21.2"
|
|
68
69
|
}
|
|
69
70
|
}
|
package/src/client.js
CHANGED
|
@@ -4,7 +4,7 @@ import action from '@cocreate/actions';
|
|
|
4
4
|
import render from '@cocreate/render';
|
|
5
5
|
import '@cocreate/element-prototype';
|
|
6
6
|
import './index.css';
|
|
7
|
-
|
|
7
|
+
import localStorage from '@cocreate/local-storage';
|
|
8
8
|
|
|
9
9
|
const CoCreateUser = {
|
|
10
10
|
init: function() {
|
|
@@ -89,11 +89,11 @@ const CoCreateUser = {
|
|
|
89
89
|
let { success, status, message, token } = data;
|
|
90
90
|
|
|
91
91
|
if (success) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
localStorage.setItem('organization_id', crud.socket.config.organization_id);
|
|
93
|
+
localStorage.setItem("apiKey", crud.socket.config.apiKey);
|
|
94
|
+
localStorage.setItem("host", crud.socket.config.host);
|
|
95
|
+
localStorage.setItem('user_id', data.document[0]['_id']);
|
|
96
|
+
localStorage.setItem("token", token);
|
|
97
97
|
document.cookie = `token=${token};path=/`;
|
|
98
98
|
message = "Succesful signIn";
|
|
99
99
|
document.dispatchEvent(new CustomEvent('signIn', {
|
|
@@ -116,8 +116,8 @@ const CoCreateUser = {
|
|
|
116
116
|
|
|
117
117
|
signOut: (btn) => {
|
|
118
118
|
self = this;
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
localStorage.removeItem("user_id");
|
|
120
|
+
localStorage.removeItem("token");
|
|
121
121
|
|
|
122
122
|
let allCookies = document.cookie.split(';');
|
|
123
123
|
|
|
@@ -230,8 +230,8 @@ const CoCreateUser = {
|
|
|
230
230
|
if (redirectTag) {
|
|
231
231
|
let redirectLink = redirectTag.getAttribute('href');
|
|
232
232
|
if (redirectLink) {
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
localStorage.removeItem("user_id");
|
|
234
|
+
localStorage.removeItem("token");
|
|
235
235
|
|
|
236
236
|
// this.deleteCookie();
|
|
237
237
|
document.location.href = redirectLink;
|
|
@@ -256,7 +256,7 @@ const CoCreateUser = {
|
|
|
256
256
|
},
|
|
257
257
|
|
|
258
258
|
initChangeOrg: () => {
|
|
259
|
-
const user_id =
|
|
259
|
+
const user_id = localStorage.getItem('user_id');
|
|
260
260
|
|
|
261
261
|
if (!user_id) return;
|
|
262
262
|
|
|
@@ -277,9 +277,9 @@ const CoCreateUser = {
|
|
|
277
277
|
_id: user_id
|
|
278
278
|
},
|
|
279
279
|
}).then((data) => {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
localStorage.setItem('apiKey', data['apiKey']);
|
|
281
|
+
localStorage.setItem('organization_id', data.document[0]['current_org']);
|
|
282
|
+
localStorage.setItem('host', crud.socket.config.host);
|
|
283
283
|
|
|
284
284
|
document.dispatchEvent(new CustomEvent('signIn'));
|
|
285
285
|
window.location.reload();
|