Added support for the homepage languages

This commit is contained in:
Joao Ramos
2024-02-29 18:26:41 +00:00
parent 773480875f
commit 79e51d6294
2 changed files with 8 additions and 3 deletions

View File

@@ -23,6 +23,8 @@ interface Contact {
number: string;
}
async function get(req: NextApiRequest, res: NextApiResponse) {
const { language = 'en' } = req.query as { language: string };
const usersQuery = query(
collection(db, "users"),
where("type", "==", "agent")
@@ -50,8 +52,9 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
const result = Object.keys(data).map((code) => {
const country = countryCodes.findOne("countryCode" as any, code);
const key = language === 'ar' ? 'countryNameLocal' : 'countryNameEn';
return {
label: country.countryNameEn,
label: country[key],
key: code,
entries: data[code],
};