Changeset View
Changeset View
Standalone View
Standalone View
lib/ops/report-store-ops.js
Show All 40 Lines | if (operation.type === 'replace_report') { | ||||
); | ); | ||||
} else if (operation.type === 'remove_all_reports') { | } else if (operation.type === 'remove_all_reports') { | ||||
processedReports = []; | processedReports = []; | ||||
} | } | ||||
} | } | ||||
return processedReports; | return processedReports; | ||||
} | } | ||||
export { processReportStoreOperations }; | function convertReportsToReplaceReportOps( | ||||
reports: $ReadOnlyArray<ClientReportCreationRequest>, | |||||
): $ReadOnlyArray<ReplaceQueuedReportOperation> { | |||||
return reports.map(report => ({ | |||||
type: 'replace_report', | |||||
payload: { report }, | |||||
})); | |||||
} | |||||
function convertReportsToRemoveReportsOperation( | |||||
reports: $ReadOnlyArray<ClientReportCreationRequest>, | |||||
): RemoveQueuedReportsOperation { | |||||
return { | |||||
type: 'remove_reports', | |||||
payload: { ids: reports.map(report => report.id) }, | |||||
}; | |||||
} | |||||
export { | |||||
processReportStoreOperations, | |||||
convertReportsToReplaceReportOps, | |||||
convertReportsToRemoveReportsOperation, | |||||
}; |