ui(admin): fix validation rules on UserForm

This commit is contained in:
Matthew Penner 2021-09-12 17:24:31 -06:00
parent 38ff35873e
commit c7ab6b9e6c
No known key found for this signature in database
GPG key ID: 030E4AB751DC756F
3 changed files with 5 additions and 4 deletions

View file

@ -12,6 +12,10 @@ export interface Values {
export default (id: number, values: Partial<Values>, include: string[] = []): Promise<User> => {
const data = {};
Object.keys(values).forEach(k => {
// Don't set password if it is empty.
if (k === 'password' && values[k] === '') {
return;
}
// @ts-ignore
data[k.replace(/[A-Z]/g, l => `_${l.toLowerCase()}`)] = values[k];
});