Refactor the DriveSelector to use async-await

Change-type: patch
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
Thodoris Greasidis 2019-12-03 20:14:59 +02:00 committed by Alexis Svinartchouk
parent abfc6be84d
commit 8177e98014

View File

@ -104,8 +104,9 @@ const getDriveListLabel = () => {
* @example * @example
* openDriveSelector(DriveSelectorService); * openDriveSelector(DriveSelectorService);
*/ */
const openDriveSelector = (DriveSelectorService) => { const openDriveSelector = async (DriveSelectorService) => {
DriveSelectorService.open().then((drive) => { try {
const drive = await DriveSelectorService.open()
if (!drive) { if (!drive) {
return return
} }
@ -118,7 +119,9 @@ const openDriveSelector = (DriveSelectorService) => {
applicationSessionUuid: store.getState().toJS().applicationSessionUuid, applicationSessionUuid: store.getState().toJS().applicationSessionUuid,
flashingWorkflowUuid: store.getState().toJS().flashingWorkflowUuid flashingWorkflowUuid: store.getState().toJS().flashingWorkflowUuid
}) })
}).catch(exceptionReporter.report) } catch (error) {
exceptionReporter.report(error)
}
} }
/** /**