Fixes all export error messages
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
import Share from 'react-native-share'
|
import Share from 'react-native-share'
|
||||||
import getDataAsCsvDataUri from '../../lib/import-export/export-to-csv'
|
import getDataAsCsvDataUri from '../../lib/import-export/export-to-csv'
|
||||||
import alertError from './alert-error'
|
import alertError from './alert-error'
|
||||||
import { settings as labels } from '../../i18n/en/settings'
|
import { settings } from '../../i18n/en/settings'
|
||||||
|
|
||||||
export default async function openShareDialogAndExport() {
|
export default async function openShareDialogAndExport() {
|
||||||
let data
|
let data
|
||||||
|
const labels = settings.export
|
||||||
try {
|
try {
|
||||||
data = getDataAsCsvDataUri()
|
data = getDataAsCsvDataUri()
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return alertError(labels.export.errors.noData)
|
return alertError(labels.errors.noData)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
@@ -17,15 +18,15 @@ export default async function openShareDialogAndExport() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await Share.open({
|
await Share.open({
|
||||||
title: labels.export.title,
|
title: labels.title,
|
||||||
url: data,
|
url: data,
|
||||||
subject: labels.export.subject,
|
subject: labels.subject,
|
||||||
type: 'text/csv',
|
type: 'text/csv',
|
||||||
showAppsToView: true
|
showAppsToView: true
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
return alertError(labels.export.errors.problemSharing)
|
return alertError(labels.errors.problemSharing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user