api key length error toaster removed

pull/5370/head
Aniket-Engg 2 years ago committed by Aniket
parent 2c44dcc8e3
commit 12b3db7db0
  1. 6
      apps/etherscan/src/app/views/CaptureKeyView.tsx

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

Loading…
Cancel
Save