@firecms/user_management 3.0.0-canary.112 → 3.0.0-canary.114

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/user_management",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.112",
4
+ "version": "3.0.0-canary.114",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,9 +29,9 @@
29
29
  "types": "dist/index.d.ts",
30
30
  "source": "src/index.ts",
31
31
  "dependencies": {
32
- "@firecms/core": "^3.0.0-canary.112",
33
- "@firecms/formex": "^3.0.0-canary.112",
34
- "@firecms/ui": "^3.0.0-canary.112",
32
+ "@firecms/core": "^3.0.0-canary.114",
33
+ "@firecms/formex": "^3.0.0-canary.114",
34
+ "@firecms/ui": "^3.0.0-canary.114",
35
35
  "date-fns": "^3.6.0"
36
36
  },
37
37
  "peerDependencies": {
@@ -55,5 +55,5 @@
55
55
  "src",
56
56
  "bin"
57
57
  ],
58
- "gitHead": "da32db5185c6e867794209172c89cf9f92abc404"
58
+ "gitHead": "4da25dc93f9634b085b6de96ce1bed4aab935626"
59
59
  }
@@ -152,28 +152,18 @@ export function useBuildUserManagement({
152
152
  console.debug("Persisting user", user);
153
153
 
154
154
  const roleIds = user.roles?.map(r => r.id);
155
- const {
156
- uid,
157
- ...userData
158
- } = user;
155
+ const email = user.email?.toLowerCase().trim();
156
+ if (!email) throw Error("Email is required");
159
157
  const data = {
160
- ...userData,
158
+ ...user,
161
159
  roles: roleIds
162
160
  };
163
- if (uid) {
164
- return dataSourceDelegate.saveEntity({
165
- status: "existing",
166
- path: usersPath,
167
- entityId: uid,
168
- values: data
169
- }).then(() => user);
170
- } else {
171
- return dataSourceDelegate.saveEntity({
172
- status: "new",
173
- path: usersPath,
174
- values: data
175
- }).then(() => user);
176
- }
161
+ return dataSourceDelegate.saveEntity({
162
+ status: "existing",
163
+ path: usersPath,
164
+ entityId: email,
165
+ values: data
166
+ }).then(() => user);
177
167
  }, [usersPath, dataSourceDelegate?.initialised]);
178
168
 
179
169
  const saveRole = useCallback((role: Role): Promise<void> => {