|
|
@ -13,7 +13,7 @@ export const CaptureKeyView = () => { |
|
|
|
const context = React.useContext(AppContext) |
|
|
|
const context = React.useContext(AppContext) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (!context.apiKey) setMsg('Please provide a 34-character API key to continue') |
|
|
|
if (!context.apiKey) setMsg('Please provide a 34 or 32 character API key to continue') |
|
|
|
}, [context.apiKey]) |
|
|
|
}, [context.apiKey]) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
@ -24,14 +24,14 @@ export const CaptureKeyView = () => { |
|
|
|
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) { |
|
|
|
} else if (values.apiKey.length !== 34 && values.apiKey.length !== 32) { |
|
|
|
errors.apiKey = 'API key should be 34 characters long' |
|
|
|
errors.apiKey = 'API key should be 34 or 32 characters long' |
|
|
|
} |
|
|
|
} |
|
|
|
return errors |
|
|
|
return errors |
|
|
|
}} |
|
|
|
}} |
|
|
|
onSubmit={(values) => { |
|
|
|
onSubmit={(values) => { |
|
|
|
const apiKey = values.apiKey |
|
|
|
const apiKey = values.apiKey |
|
|
|
if (apiKey.length === 34) { |
|
|
|
if (apiKey.length === 34 || apiKey.length === 32) { |
|
|
|
context.setAPIKey(values.apiKey) |
|
|
|
context.setAPIKey(values.apiKey) |
|
|
|
navigate(location && location.state ? location.state : '/') |
|
|
|
navigate(location && location.state ? location.state : '/') |
|
|
|
} |
|
|
|
} |
|
|
|