api key length error toaster removed

pull/3916/head
Aniket-Engg 1 year ago committed by Aniket
parent ca97fa4b47
commit 1984e60c73
  1. 6
      apps/etherscan/src/app/views/CaptureKeyView.tsx

@ -23,6 +23,8 @@ export const CaptureKeyView: React.FC = () => {
const errors = {} as any
if (!values.apiKey) {
errors.apiKey = "Required"
} else if (values.apiKey.length !== 34) {
errors.apiKey = "API key should be 34 characters long"
}
return errors
}}
@ -32,7 +34,7 @@ export const CaptureKeyView: React.FC = () => {
setAPIKey(values.apiKey)
clientInstance.call('notification' as any, 'toast', 'API key saved successfully!!!')
navigate((location && location.state ? location.state : '/'))
} else clientInstance.call('notification' as any, 'toast', 'API key should be 34 characters long')
}
}}
>
{({ errors, touched, handleSubmit }) => (
@ -57,7 +59,7 @@ export const CaptureKeyView: React.FC = () => {
</div>
<div>
<SubmitButton text="Save" dataId="save-api-key" disable={false} />
<SubmitButton text="Save" dataId="save-api-key" disable={ errors && errors.apiKey ? true : false } />
</div>
</form>
)}

Loading…
Cancel
Save