diff --git a/src/api/index.js b/src/api/index.js index 1a010f7..7a15115 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -10,7 +10,7 @@ export const fetchAgeGroups = async (language) => { } export const fetchSingleAgeGroup = async (id) => { - const res = await fetch(`${PARTIO_API_URL}/age-groups/${id}`) + const res = await fetch(`${PARTIO_API_URL}/age-groups/${id}?populate=*`) const ageGroup = await res.json() return ageGroup.data } @@ -18,31 +18,31 @@ export const fetchSingleAgeGroup = async (id) => { export const fetchActivityGroups = async (language) => { const locale = language === undefined ? 'fi' : language const countRes = await fetch( - `${PARTIO_API_URL}/activity-groups?locale=${locale}` + `${PARTIO_API_URL}/activity-groups?populate=*&locale=${locale}` ) const count = await countRes.json() const res = await fetch( - `${PARTIO_API_URL}/activity-groups?pagination[start]=0&pagination[limit]=${count.meta.pagination.total}&locale=${locale}` + `${PARTIO_API_URL}/activity-groups?pagination[start]=0&pagination[limit]=${count.meta.pagination.total}&locale=${locale}&populate=*` ) const activityGroups = await res.json() return activityGroups.data } export const fetchSingleActivityGroup = async (id) => { - const res = await fetch(`${PARTIO_API_URL}/activity-groups/${id}`) + const res = await fetch(`${PARTIO_API_URL}/activity-groups/${id}?populate=*`) const activityGroup = await res.json() return activityGroup.data } export const fetchActivities = async () => { - const res = await fetch(`${PARTIO_API_URL}/activities`) + const res = await fetch(`${PARTIO_API_URL}/activities?populate=*`) const activities = await res.json() return activities.data } export const fetchActivity = async (wp_guid, language) => { const res = await fetch( - `${PARTIO_API_URL}/activities?wp_guid=${wp_guid}&locale=${language}` + `${PARTIO_API_URL}/activities?populate=*&wp_guid=${wp_guid}&locale=${language}` ) const activity = await res.json() return activity.data @@ -57,9 +57,12 @@ export const fetchTaskDetails = async (guid, lang) => { } export const fetchTranslations = async (lang) => { - const res = await await fetch(`${PARTIO_API_URL}/setting?locale=${lang}`) + const res = await await fetch( + `${PARTIO_API_URL}/setting?populate=*&locale=${lang}` + ) const translations = await res.json() - return translations.data + console.log(translations) + return translations.data.translations } // POS BACKEND