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