fix: DataExportSection error

- Fixed improper referencing for PlatformServiceMixin
- Fixed case where exported data has no contact methods

authored-by: Matthew Raymer <matthew.raymer@anomalistdesign.com>
This commit is contained in:
Matthew Raymer
2025-08-11 08:06:09 +00:00
parent 91e46f435e
commit de47829dc2
2 changed files with 115 additions and 25 deletions

View File

@@ -178,8 +178,8 @@ export default class DataExportSection extends Vue {
try {
this.isExporting = true;
// Fetch contacts from database using database utility
const allContacts = await this.$databaseUtil.getContacts();
// Fetch contacts from database using mixin's cached method
const allContacts = await this.$contacts();
// Convert contacts to export format
const processedContacts: Contact[] = allContacts.map((contact) => {
@@ -187,8 +187,10 @@ export default class DataExportSection extends Vue {
const exContact: Contact = R.omit(["contactMethods"], contact);
// now add contactMethods as a true array of ContactMethod objects
exContact.contactMethods = contact.contactMethods
? JSON.parse(contact.contactMethods as string)
: undefined;
? (typeof contact.contactMethods === 'string' && contact.contactMethods.trim() !== ''
? JSON.parse(contact.contactMethods)
: [])
: [];
return exContact;
});