mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(settings): crypto address setting would show error for an already set address
This commit is contained in:
@@ -41,6 +41,10 @@
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
.saved {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: red;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ const CryptoAddressSetting = () => {
|
||||
const account = useAccount();
|
||||
|
||||
const [cryptoState, setCryptoState] = useState({
|
||||
cryptoAddress: '',
|
||||
cryptoAddress: account?.author?.shortAddress.includes('.') ? account.author.shortAddress : '',
|
||||
checkingCryptoAddress: false,
|
||||
showResolvingMessage: true,
|
||||
resolveString: t('crypto_address_verification'),
|
||||
@@ -62,6 +62,12 @@ const CryptoAddressSetting = () => {
|
||||
if (!cryptoState.cryptoAddress || !cryptoState.cryptoAddress.includes('.')) {
|
||||
alert(t('enter_crypto_address'));
|
||||
return;
|
||||
} else if (cryptoState.cryptoAddress === account?.author?.address) {
|
||||
setSavedCryptoAddress(true);
|
||||
setTimeout(() => {
|
||||
setSavedCryptoAddress(false);
|
||||
}, 2000);
|
||||
return;
|
||||
} else if (resolvedAddress && resolvedAddress !== account?.signer?.address) {
|
||||
alert(t('crypto_address_not_yours'));
|
||||
return;
|
||||
@@ -110,7 +116,7 @@ const CryptoAddressSetting = () => {
|
||||
<input
|
||||
type='text'
|
||||
placeholder='address.eth/.sol'
|
||||
value={inputValue}
|
||||
value={cryptoState.cryptoAddress}
|
||||
onChange={(e) => {
|
||||
setInputValue(e.target.value);
|
||||
setCryptoState((prevState) => ({ ...prevState, cryptoAddress: e.target.value }));
|
||||
|
||||
Reference in New Issue
Block a user