fix: Handle invalid country code in contact details (#4081)
This commit is contained in:
@@ -210,8 +210,7 @@ export default {
|
|||||||
if (!cityAndCountry) {
|
if (!cityAndCountry) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const countryFlag = countryCode ? flag(countryCode) : '🌎';
|
return this.findCountryFlag(countryCode, cityAndCountry);
|
||||||
return `${cityAndCountry} ${countryFlag}`;
|
|
||||||
},
|
},
|
||||||
socialProfiles() {
|
socialProfiles() {
|
||||||
const {
|
const {
|
||||||
@@ -261,6 +260,14 @@ export default {
|
|||||||
this.showConversationModal = false;
|
this.showConversationModal = false;
|
||||||
this.showEditModal = false;
|
this.showEditModal = false;
|
||||||
},
|
},
|
||||||
|
findCountryFlag(countryCode, cityAndCountry) {
|
||||||
|
try {
|
||||||
|
const countryFlag = countryCode ? flag(countryCode) : '🌎';
|
||||||
|
return `${cityAndCountry} ${countryFlag}`;
|
||||||
|
} catch (error) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
async deleteContact({ id }) {
|
async deleteContact({ id }) {
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('contacts/delete', id);
|
await this.$store.dispatch('contacts/delete', id);
|
||||||
|
|||||||
Reference in New Issue
Block a user