@firecms/user_management 3.0.0-canary.93 → 3.0.0-canary.94
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/dist/index.es.js +10 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/hooks/useBuildUserManagement.tsx +10 -6
package/dist/index.umd.js
CHANGED
@@ -185,18 +185,20 @@
|
|
185
185
|
if (!equal(newRoles, roles))
|
186
186
|
setRoles(newRoles);
|
187
187
|
} catch (e) {
|
188
|
+
setRoles([]);
|
188
189
|
console.error("Error loading roles", e);
|
189
190
|
setRolesError(e);
|
190
191
|
}
|
191
192
|
setRolesLoading(false);
|
192
193
|
},
|
193
194
|
onError(e) {
|
195
|
+
setRoles([]);
|
194
196
|
console.error("Error loading roles", e);
|
195
197
|
setRolesError(e);
|
196
198
|
setRolesLoading(false);
|
197
199
|
}
|
198
200
|
});
|
199
|
-
}, [dataSourceDelegate, rolesPath]);
|
201
|
+
}, [dataSourceDelegate?.initialised, rolesPath]);
|
200
202
|
React.useEffect(() => {
|
201
203
|
if (!dataSourceDelegate || !usersPath) return;
|
202
204
|
if (dataSourceDelegate.initialised !== void 0 && !dataSourceDelegate.initialised) return;
|
@@ -209,18 +211,20 @@
|
|
209
211
|
if (!equal(newUsers, usersWithRoleIds))
|
210
212
|
setUsersWithRoleIds(newUsers);
|
211
213
|
} catch (e) {
|
214
|
+
setUsersWithRoleIds([]);
|
212
215
|
console.error("Error loading users", e);
|
213
216
|
setUsersError(e);
|
214
217
|
}
|
215
218
|
setUsersLoading(false);
|
216
219
|
},
|
217
220
|
onError(e) {
|
221
|
+
setUsersWithRoleIds([]);
|
218
222
|
console.error("Error loading users", e);
|
219
223
|
setUsersError(e);
|
220
224
|
setUsersLoading(false);
|
221
225
|
}
|
222
226
|
});
|
223
|
-
}, [dataSourceDelegate, usersPath]);
|
227
|
+
}, [dataSourceDelegate?.initialised, usersPath]);
|
224
228
|
const saveUser = React.useCallback(async (user) => {
|
225
229
|
if (!dataSourceDelegate) throw Error("useBuildUserManagement Firebase not initialised");
|
226
230
|
if (!usersPath) throw Error("useBuildUserManagement Firestore not initialised");
|
@@ -248,7 +252,7 @@
|
|
248
252
|
values: data
|
249
253
|
}).then(() => user);
|
250
254
|
}
|
251
|
-
}, [usersPath, dataSourceDelegate]);
|
255
|
+
}, [usersPath, dataSourceDelegate?.initialised]);
|
252
256
|
const saveRole = React.useCallback((role) => {
|
253
257
|
if (!dataSourceDelegate) throw Error("useBuildUserManagement Firebase not initialised");
|
254
258
|
if (!rolesPath) throw Error("useBuildUserManagement Firestore not initialised");
|
@@ -265,7 +269,7 @@
|
|
265
269
|
}).then(() => {
|
266
270
|
return;
|
267
271
|
});
|
268
|
-
}, [rolesPath, dataSourceDelegate]);
|
272
|
+
}, [rolesPath, dataSourceDelegate?.initialised]);
|
269
273
|
const deleteUser = React.useCallback(async (user) => {
|
270
274
|
if (!dataSourceDelegate) throw Error("useBuildUserManagement Firebase not initialised");
|
271
275
|
if (!usersPath) throw Error("useBuildUserManagement Firestore not initialised");
|
@@ -277,7 +281,7 @@
|
|
277
281
|
values: {}
|
278
282
|
};
|
279
283
|
await dataSourceDelegate.deleteEntity({ entity });
|
280
|
-
}, [usersPath, dataSourceDelegate]);
|
284
|
+
}, [usersPath, dataSourceDelegate?.initialised]);
|
281
285
|
const deleteRole = React.useCallback(async (role) => {
|
282
286
|
if (!dataSourceDelegate) throw Error("useBuildUserManagement Firebase not initialised");
|
283
287
|
if (!rolesPath) throw Error("useBuildUserManagement Firestore not initialised");
|
@@ -289,7 +293,7 @@
|
|
289
293
|
values: {}
|
290
294
|
};
|
291
295
|
await dataSourceDelegate.deleteEntity({ entity });
|
292
|
-
}, [rolesPath, dataSourceDelegate]);
|
296
|
+
}, [rolesPath, dataSourceDelegate?.initialised]);
|
293
297
|
const collectionPermissions = React.useCallback(({
|
294
298
|
collection,
|
295
299
|
user
|