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;
|
margin: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.saved {
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.red {
|
.red {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const CryptoAddressSetting = () => {
|
|||||||
const account = useAccount();
|
const account = useAccount();
|
||||||
|
|
||||||
const [cryptoState, setCryptoState] = useState({
|
const [cryptoState, setCryptoState] = useState({
|
||||||
cryptoAddress: '',
|
cryptoAddress: account?.author?.shortAddress.includes('.') ? account.author.shortAddress : '',
|
||||||
checkingCryptoAddress: false,
|
checkingCryptoAddress: false,
|
||||||
showResolvingMessage: true,
|
showResolvingMessage: true,
|
||||||
resolveString: t('crypto_address_verification'),
|
resolveString: t('crypto_address_verification'),
|
||||||
@@ -62,6 +62,12 @@ const CryptoAddressSetting = () => {
|
|||||||
if (!cryptoState.cryptoAddress || !cryptoState.cryptoAddress.includes('.')) {
|
if (!cryptoState.cryptoAddress || !cryptoState.cryptoAddress.includes('.')) {
|
||||||
alert(t('enter_crypto_address'));
|
alert(t('enter_crypto_address'));
|
||||||
return;
|
return;
|
||||||
|
} else if (cryptoState.cryptoAddress === account?.author?.address) {
|
||||||
|
setSavedCryptoAddress(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setSavedCryptoAddress(false);
|
||||||
|
}, 2000);
|
||||||
|
return;
|
||||||
} else if (resolvedAddress && resolvedAddress !== account?.signer?.address) {
|
} else if (resolvedAddress && resolvedAddress !== account?.signer?.address) {
|
||||||
alert(t('crypto_address_not_yours'));
|
alert(t('crypto_address_not_yours'));
|
||||||
return;
|
return;
|
||||||
@@ -110,7 +116,7 @@ const CryptoAddressSetting = () => {
|
|||||||
<input
|
<input
|
||||||
type='text'
|
type='text'
|
||||||
placeholder='address.eth/.sol'
|
placeholder='address.eth/.sol'
|
||||||
value={inputValue}
|
value={cryptoState.cryptoAddress}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setInputValue(e.target.value);
|
setInputValue(e.target.value);
|
||||||
setCryptoState((prevState) => ({ ...prevState, cryptoAddress: e.target.value }));
|
setCryptoState((prevState) => ({ ...prevState, cryptoAddress: e.target.value }));
|
||||||
|
|||||||
Reference in New Issue
Block a user