Only trim name on create (#1756)
This commit is contained in:
parent
4d2615850b
commit
ac854e4d2c
@ -142,11 +142,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
|||||||
setAddress(generateSeed(null, derivePath, newSeedType, pairType));
|
setAddress(generateSeed(null, derivePath, newSeedType, pairType));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const _onChangeName = (_name: string): void => {
|
const _onChangeName = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||||
const name = _name.trim();
|
|
||||||
|
|
||||||
setName({ isNameValid: !!name, name });
|
|
||||||
};
|
|
||||||
const _toggleConfirmation = (): void => setIsConfirmationOpen(!isConfirmationOpen);
|
const _toggleConfirmation = (): void => setIsConfirmationOpen(!isConfirmationOpen);
|
||||||
|
|
||||||
const _onCommit = (): void => {
|
const _onCommit = (): void => {
|
||||||
@ -158,7 +154,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
|||||||
const status = { action: 'create' } as ActionStatus;
|
const status = { action: 'create' } as ActionStatus;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { json, pair } = keyring.addUri(`${seed}${derivePath}`, password, { name, tags: [] }, pairType);
|
const { json, pair } = keyring.addUri(`${seed}${derivePath}`, password, { name: name.trim(), tags: [] }, pairType);
|
||||||
const blob = new Blob([JSON.stringify(json)], { type: 'application/json; charset=utf-8' });
|
const blob = new Blob([JSON.stringify(json)], { type: 'application/json; charset=utf-8' });
|
||||||
const { address } = pair;
|
const { address } = pair;
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ function Create ({ onClose, onStatusChange, t }: Props): React.ReactElement<Prop
|
|||||||
|
|
||||||
setAddress({ address: address || input, isAddressExisting, isAddressValid });
|
setAddress({ address: address || input, isAddressExisting, isAddressValid });
|
||||||
};
|
};
|
||||||
const _onChangeName = (name: string): void => setName({ isNameValid: !!name, name });
|
const _onChangeName = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||||
const _onCommit = (): void => {
|
const _onCommit = (): void => {
|
||||||
const status = { action: 'create' } as ActionStatus;
|
const status = { action: 'create' } as ActionStatus;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ function Create ({ onClose, onStatusChange, t }: Props): React.ReactElement<Prop
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
keyring.saveAddress(address, { name, genesisHash: keyring.genesisHash, tags: [] });
|
keyring.saveAddress(address, { name: name.trim(), genesisHash: keyring.genesisHash, tags: [] });
|
||||||
|
|
||||||
status.account = address;
|
status.account = address;
|
||||||
status.status = address ? 'success' : 'error';
|
status.status = address ? 'success' : 'error';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user