fix: Use empty object if additional_attribute is null (#1520)

This commit is contained in:
Pranav Raj S 2020-12-16 15:11:53 +05:30 committed by GitHub
parent 6373e6dec8
commit 50f87f373e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,20 +112,19 @@ export default {
return `${this.browser.browser_name || ''} ${this.browser
.browser_version || ''}`;
},
contactAdditionalAttributes() {
return this.contact.additional_attributes || {};
},
ipAddress() {
const {
additional_attributes: { created_at_ip: createdAtIp },
} = this.contact;
const { created_at_ip: createdAtIp } = this.contactAdditionalAttributes;
return createdAtIp;
},
location() {
const {
additional_attributes: {
country = '',
city = '',
country_code: countryCode,
},
} = this.contact;
country = '',
city = '',
country_code: countryCode,
} = this.contactAdditionalAttributes;
const cityAndCountry = [city, country].filter(item => !!item).join(', ');
if (!cityAndCountry) {