Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/longevity/about-project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export async function getAboutProject(locale: string) {
const base = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-what-is-this`;
const base = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-about-project`;

const currentLocale = locale === 'ru' ? 'ru' : 'en';

Expand Down
2 changes: 1 addition & 1 deletion src/api/longevity/diet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function getDiet(locale: string) {
next: { revalidate: 3600 },
});

if (!res.ok) throw new Error('Failed to fetch contributor');
if (!res.ok) throw new Error('Failed to fetch Diet');

const json = await res.json();
const attrs = json?.data?.attributes ?? {};
Expand Down
3 changes: 2 additions & 1 deletion src/api/longevity/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export async function getEnvironment(locale: string) {
const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-environment?populate[home][populate]=icon&populate[principles][populate]=icon&populate[data_tracking][populate]=icon&[populate]=image&populate[OGTags][populate]=ogImage&populate=Seo&locale=${locale}`;
const chosenLocale = locale === 'ru' ? 'ru' : 'en';
const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-environment?populate[home][populate]=icon&populate[principles][populate]=icon&populate[data_tracking][populate]=icon&[populate]=image&populate[OGTags][populate]=ogImage&populate=Seo&locale=${chosenLocale}`;

const res = await fetch(url, {
next: { revalidate: 3600 },
Expand Down
3 changes: 1 addition & 2 deletions src/api/longevity/lifestyle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export async function getLifestyleProtocol(locale: string) {
const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-habit-protocol?populate=*&locale=${locale}`;

const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-lifestyle?populate=*&locale=${locale}`;
const res = await fetch(url, {
next: { revalidate: 3600 },
});
Expand Down
3 changes: 2 additions & 1 deletion src/api/longevity/study.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export async function getStudy(locale: string) {
const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-study?populate=*&locale=${locale}`;
const chosenLocale = locale === 'ru' ? 'ru' : 'en';
const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-study?populate=*&locale=${chosenLocale}`;

const res = await fetch(url, {
next: { revalidate: 3600 },
Expand Down
3 changes: 2 additions & 1 deletion src/api/longevity/supplements.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export async function getSupplements(locale: string) {
const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-supplement?populate=*&locale=${locale}`;
const chosenLocale = locale === 'ru' ? 'ru' : 'en';
const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/longevity-supplement?populate=*&locale=${chosenLocale}`;

const res = await fetch(url, {
next: { revalidate: 3600 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const WhatToEatOrAvoid: FC<WhatToEatOrAvoidProps> = ({
getPText(examples);
setExampleContent(getPText(examples));
}, []);
console.log(selectedHealthyOptionId, ', id');

return (
<div
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/habits/diet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ const Diet = ({ dietData }) => {
export default Diet;

export const getStaticProps: GetStaticProps = async ({ locale }) => {
const dietData = await getDiet(locale);
const chosenLocale = locale === 'ru' ? 'ru' : 'en';

const dietData = await getDiet(chosenLocale);

return {
props: { dietData },
Expand Down
3 changes: 2 additions & 1 deletion src/pages/tools/longevity-protocol/habits/lifestyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const Lifestyle = ({ habitsData }) => {
export default Lifestyle;

export const getStaticProps: GetStaticProps = async ({ locale }) => {
const habitsData = await getLifestyleProtocol(locale);
const chosenLocale = locale === 'ru' ? 'ru' : 'en';
const habitsData = await getLifestyleProtocol(chosenLocale);

return {
props: { habitsData },
Expand Down
5 changes: 3 additions & 2 deletions src/pages/tools/longevity-protocol/habits/sleep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ const Sleep = ({ sleepData, sleepSupplements }) => {
export default Sleep;

export const getStaticProps: GetStaticProps = async ({ locale }) => {
const sleepData = await getSleep(locale);
const sleepSupplements = await getSleepSupplements(locale || 'en');
const chosenLocale = locale === 'ru' ? 'ru' : 'en';
const sleepData = await getSleep(chosenLocale);
const sleepSupplements = await getSleepSupplements(chosenLocale || 'en');

return {
props: { sleepData, locale: locale ?? 'en', sleepSupplements },
Expand Down
3 changes: 2 additions & 1 deletion src/pages/tools/longevity-protocol/habits/workout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const Workout = ({ workoutData }) => {
export default Workout;

export const getStaticProps: GetStaticProps = async ({ locale }) => {
const workoutData = await getWorkout(locale);
const chosenLocale = locale === 'ru' ? 'ru' : 'en';
const workoutData = await getWorkout(chosenLocale);

return {
props: { workoutData },
Expand Down