Show country flags for ISO coded countries (#2230)

This commit is contained in:
InfiniteTF 2022-01-12 01:34:11 +01:00 committed by GitHub
parent 7a0aa5d94a
commit db55b1746a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,8 +20,10 @@ const fuzzyDict: Record<string, string> = {
const getISOCountry = (country: string | null | undefined) => {
if (!country) return null;
const code = fuzzyDict[country] ?? Countries.getAlpha2Code(country, "en");
if (!code) return null;
const code =
fuzzyDict[country] ?? Countries.getAlpha2Code(country, "en") ?? country;
// Check if code is valid alpha2 iso
if (!Countries.alpha2ToAlpha3(code)) return null;
return {
code,