Fixes all export error messages

This commit is contained in:
mashazyu
2018-12-09 22:30:33 +01:00
parent 5cb4d9f861
commit 420befec36
+6 -5
View File
@@ -1,14 +1,15 @@
import Share from 'react-native-share'
import getDataAsCsvDataUri from '../../lib/import-export/export-to-csv'
import alertError from './alert-error'
import { settings as labels } from '../../i18n/en/settings'
import { settings } from '../../i18n/en/settings'
export default async function openShareDialogAndExport() {
let data
const labels = settings.export
try {
data = getDataAsCsvDataUri()
if (!data) {
return alertError(labels.export.errors.noData)
return alertError(labels.errors.noData)
}
} catch (err) {
console.error(err)
@@ -17,15 +18,15 @@ export default async function openShareDialogAndExport() {
try {
await Share.open({
title: labels.export.title,
title: labels.title,
url: data,
subject: labels.export.subject,
subject: labels.subject,
type: 'text/csv',
showAppsToView: true
})
} catch (err) {
console.error(err)
return alertError(labels.export.errors.problemSharing)
return alertError(labels.errors.problemSharing)
}
}