|
@ -25,13 +25,16 @@ type Props = { |
|
|
renderDefault: ( |
|
|
renderDefault: ( |
|
|
device: ?Device, |
|
|
device: ?Device, |
|
|
deviceInfo: ?DeviceInfo, |
|
|
deviceInfo: ?DeviceInfo, |
|
|
dashboardError: ?Error, |
|
|
|
|
|
isGenuine: ?boolean, |
|
|
isGenuine: ?boolean, |
|
|
|
|
|
error: { |
|
|
|
|
|
dashboardError: ?Error, |
|
|
|
|
|
genuineError: ?Error, |
|
|
|
|
|
}, |
|
|
) => Node, |
|
|
) => Node, |
|
|
renderMcuUpdate: (deviceInfo: DeviceInfo) => Node, |
|
|
renderMcuUpdate: (deviceInfo: DeviceInfo) => Node, |
|
|
renderFinalUpdate: (deviceInfo: DeviceInfo) => Node, |
|
|
renderFinalUpdate: (deviceInfo: DeviceInfo) => Node, |
|
|
renderDashboard: (device: Device, deviceInfo: DeviceInfo) => Node, |
|
|
renderDashboard: (device: Device, deviceInfo: DeviceInfo) => Node, |
|
|
renderError: (dashboardError: ?Error, genuineError: ?Error) => Node, |
|
|
renderError?: (dashboardError: ?Error, genuineError: ?Error) => Node, |
|
|
} |
|
|
} |
|
|
type State = {} |
|
|
type State = {} |
|
|
|
|
|
|
|
@ -52,14 +55,12 @@ class Workflow extends PureComponent<Props, State> { |
|
|
<EnsureGenuine device={device}> |
|
|
<EnsureGenuine device={device}> |
|
|
{(isGenuine: ?boolean, genuineError: ?Error) => { |
|
|
{(isGenuine: ?boolean, genuineError: ?Error) => { |
|
|
if (dashboardError || genuineError) { |
|
|
if (dashboardError || genuineError) { |
|
|
return renderError ? ( |
|
|
return renderError |
|
|
renderError(dashboardError, genuineError) |
|
|
? renderError(dashboardError, genuineError) |
|
|
) : ( |
|
|
: renderDefault(device, deviceInfo, isGenuine, { |
|
|
<div> |
|
|
genuineError, |
|
|
{dashboardError && <span>{dashboardError.message}</span>} |
|
|
dashboardError, |
|
|
{genuineError && <span>{genuineError.message}</span>} |
|
|
}) |
|
|
</div> |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (deviceInfo && deviceInfo.mcu) { |
|
|
if (deviceInfo && deviceInfo.mcu) { |
|
@ -74,7 +75,10 @@ class Workflow extends PureComponent<Props, State> { |
|
|
return renderDashboard(device, deviceInfo) |
|
|
return renderDashboard(device, deviceInfo) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return renderDefault(device, deviceInfo, dashboardError, isGenuine) |
|
|
return renderDefault(device, deviceInfo, isGenuine, { |
|
|
|
|
|
genuineError, |
|
|
|
|
|
dashboardError, |
|
|
|
|
|
}) |
|
|
}} |
|
|
}} |
|
|
</EnsureGenuine> |
|
|
</EnsureGenuine> |
|
|
)} |
|
|
)} |
|
|