Fine tune scan status behaviour

This commit is contained in:
Deluan
2020-11-12 16:12:31 -05:00
parent 0e7163eb2c
commit c09ba509b2
5 changed files with 76 additions and 26 deletions
+8 -2
View File
@@ -1,12 +1,18 @@
export const EVENT_SCAN_STATUS = 'ACTIVITY_SCAN_STATUS_UPD'
export const EVENT_SCAN_STATUS = 'EVENT_SCAN_STATUS'
const actionsMap = { scanStatus: EVENT_SCAN_STATUS }
export const processEvent = (data) => {
let type = actionsMap[data.name]
if (!type) type = 'EVENT_UNKNOWN'
if (!type) type = data.name
return {
type,
data: data.data,
}
}
export const scanStatusUpdate = (data) =>
processEvent({
name: EVENT_SCAN_STATUS,
data: data,
})