Uppercased the country code to prevent API errors
This commit is contained in:
@@ -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({
|
||||||
|
|||||||
@@ -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],
|
||||||
|
|||||||
Reference in New Issue
Block a user