Browse Source

Fix 'onUnavailable is not a function' when no network

master
Gaëtan Renaudeau 7 years ago
parent
commit
3c400afe94
  1. 8
      src/components/GenuineCheck.js

8
src/components/GenuineCheck.js

@ -31,8 +31,8 @@ const DeviceNotGenuineError = createCustomErrorClass('DeviceNotGenuine')
type Props = {
t: T,
onSuccess: void => void,
onFail: Error => void,
onUnavailable: Error => void,
onFail?: Error => void,
onUnavailable?: Error => void,
device: ?Device,
}
@ -92,9 +92,9 @@ class GenuineCheck extends PureComponent<Props> {
handleFail = (err: Error) => {
const { onFail, onUnavailable } = this.props
if (err instanceof DeviceNotGenuineError) {
onFail(err)
onFail && onFail(err)
} else {
onUnavailable(err)
onUnavailable && onUnavailable(err)
}
}

Loading…
Cancel
Save