mirror of
https://github.com/logto-io/logto.git
synced 2024-12-23 20:33:16 -05:00
refactor(console): use nullable in form type (#452)
This commit is contained in:
parent
b46cfd2bc3
commit
3f8cc6af69
1 changed files with 8 additions and 11 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { User } from '@logto/schemas';
|
import { User } from '@logto/schemas';
|
||||||
|
import { Nullable } from '@silverhand/essentials';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useController, useForm } from 'react-hook-form';
|
import { useController, useForm } from 'react-hook-form';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
|
@ -31,12 +32,12 @@ import UserConnectors from './components/UserConnectors';
|
||||||
import * as styles from './index.module.scss';
|
import * as styles from './index.module.scss';
|
||||||
|
|
||||||
type FormData = {
|
type FormData = {
|
||||||
primaryEmail: string;
|
primaryEmail: Nullable<string>;
|
||||||
primaryPhone: string;
|
primaryPhone: Nullable<string>;
|
||||||
username: string;
|
username: Nullable<string>;
|
||||||
name: string;
|
name: Nullable<string>;
|
||||||
avatar: string;
|
avatar: Nullable<string>;
|
||||||
roles: string;
|
roles: Nullable<string>;
|
||||||
customData: string;
|
customData: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,11 +62,7 @@ const UserDetails = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reset({
|
reset({
|
||||||
primaryEmail: data.primaryEmail ?? '',
|
...data,
|
||||||
primaryPhone: data.primaryPhone ?? '',
|
|
||||||
username: data.username ?? '',
|
|
||||||
name: data.name ?? '',
|
|
||||||
avatar: data.avatar ?? '',
|
|
||||||
roles: data.roleNames.join(','),
|
roles: data.roleNames.join(','),
|
||||||
customData: JSON.stringify(data.customData, null, 2),
|
customData: JSON.stringify(data.customData, null, 2),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue