Uppercased the country code to prevent API errors

This commit is contained in:
Joao Ramos
2024-02-29 18:35:30 +00:00
parent 79e51d6294
commit 424b72efaf
2 changed files with 2 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
return newUser; return newUser;
}) as Contact[]; }) as Contact[];
const country = countryCodes.findOne("countryCode" as any, code); const country = countryCodes.findOne("countryCode" as any, code.toUpperCase());
const key = language === 'ar' ? 'countryNameLocal' : 'countryNameEn'; const key = language === 'ar' ? 'countryNameLocal' : 'countryNameEn';
res.json({ res.json({

View File

@@ -51,7 +51,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
) as Record<string, Contact[]>; ) as Record<string, Contact[]>;
const result = Object.keys(data).map((code) => { const result = Object.keys(data).map((code) => {
const country = countryCodes.findOne("countryCode" as any, code); const country = countryCodes.findOne("countryCode" as any, code.toUpperCase());
const key = language === 'ar' ? 'countryNameLocal' : 'countryNameEn'; const key = language === 'ar' ? 'countryNameLocal' : 'countryNameEn';
return { return {
label: country[key], label: country[key],