Skip to content

Commit 1984e60

Browse files
committed
api key length error toaster removed
1 parent ca97fa4 commit 1984e60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/etherscan/src/app/views/CaptureKeyView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export const CaptureKeyView: React.FC = () => {
2323
const errors = {} as any
2424
if (!values.apiKey) {
2525
errors.apiKey = "Required"
26+
} else if (values.apiKey.length !== 34) {
27+
errors.apiKey = "API key should be 34 characters long"
2628
}
2729
return errors
2830
}}
@@ -32,7 +34,7 @@ export const CaptureKeyView: React.FC = () => {
3234
setAPIKey(values.apiKey)
3335
clientInstance.call('notification' as any, 'toast', 'API key saved successfully!!!')
3436
navigate((location && location.state ? location.state : '/'))
35-
} else clientInstance.call('notification' as any, 'toast', 'API key should be 34 characters long')
37+
}
3638
}}
3739
>
3840
{({ errors, touched, handleSubmit }) => (
@@ -57,7 +59,7 @@ export const CaptureKeyView: React.FC = () => {
5759
</div>
5860

5961
<div>
60-
<SubmitButton text="Save" dataId="save-api-key" disable={false} />
62+
<SubmitButton text="Save" dataId="save-api-key" disable={ errors && errors.apiKey ? true : false } />
6163
</div>
6264
</form>
6365
)}

0 commit comments

Comments
 (0)