Skip to content

Commit

Permalink
Update coutriesByJson function
Browse files Browse the repository at this point in the history
  • Loading branch information
koechkevin committed May 20, 2024
1 parent cee2807 commit 2109783
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/charterafrica/src/lib/data/json/locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ const locations = [
},
];

export const countriesByContinent = (continent) => {
export const locationsByContinent = (continent) => {
return locations
.filter((country) => continent === country.continent)
.map(({ continent: cntnt, name, ...c }) => c);
Expand Down
4 changes: 2 additions & 2 deletions apps/charterafrica/src/lib/openAfrica.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as Sentry from "@sentry/nextjs";

import { countriesByContinent } from "@/charterafrica/lib/data/json/locations";
import { locationsByContinent } from "@/charterafrica/lib/data/json/locations";
import fetchJson from "@/charterafrica/utils/fetchJson";

const OPEN_AFRICA_URL = "https://open.africa/";
const OPEN_AFRICA_BASE_API_URL = `${OPEN_AFRICA_URL}api/3/action/`;
const PAGE_SIZE = 10;
const AFRICA_COUNTRIES_BY_LOCALE = ["en", "fr", "pt"].reduce((acc, cur) => {
acc[cur] = countriesByContinent("Africa").map(({ label, value }) => ({
acc[cur] = locationsByContinent("Africa").map(({ label, value }) => ({
value: value.toLowerCase(),
label: label[cur],
}));
Expand Down
4 changes: 2 additions & 2 deletions apps/charterafrica/src/payload/collections/Tools.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
allLocations,
countriesByContinent,
locationsByContinent,
} from "../../lib/data/json/locations";
import avatarUrl from "../fields/avatarUrl";
import dateField from "../fields/dateField";
Expand Down Expand Up @@ -93,7 +93,7 @@ const Tools = {
{
name: "operatingCountries",
type: "select",
options: countriesByContinent("Africa"),
options: locationsByContinent("Africa"),
label: {
en: "Operating Countries",
fr: "Pays opérationnels",
Expand Down

0 comments on commit 2109783

Please sign in to comment.