fix: empty countryCode of current account causes crash (#1603)

* fix: empty countryCode of current account cause crush

* Update UserEditPage.js

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
Yaodong Yu
2023-03-01 22:09:48 +08:00
committed by GitHub
parent d21ae8a478
commit 8696b08db2
3 changed files with 12 additions and 5 deletions

View File

@ -209,7 +209,10 @@ export function initCountries() {
}
export function getCountryCode(country) {
return phoneNumber.getCountryCallingCode(country);
if (phoneNumber.isSupportedCountry(country)) {
return phoneNumber.getCountryCallingCode(country);
}
return "";
}
export function getCountryCodeData(countryCodes = phoneNumber.getCountries()) {