fix
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
// app/[locale]/about/page.tsx
|
// app/[locale]/about/page.tsx
|
||||||
export const revalidate = 0;
|
|
||||||
import { partner_api } from '@/features/about/lib/api';
|
|
||||||
import { AboutContent } from '@/features/about/ui/AboutContent';
|
import { AboutContent } from '@/features/about/ui/AboutContent';
|
||||||
import { AboutHero } from '@/features/about/ui/AboutHero';
|
import { AboutHero } from '@/features/about/ui/AboutHero';
|
||||||
import { PartnershipForm } from '@/features/about/ui/AboutPage';
|
import { PartnershipForm } from '@/features/about/ui/AboutPage';
|
||||||
import { BASE_URL } from '@/shared/config/api/URLs';
|
import { API_URLS, BASE_URL } from '@/shared/config/api/URLs';
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
|
|
||||||
function getImageUrl(image?: string | null): string {
|
function getImageUrl(image?: string | null): string {
|
||||||
@@ -12,9 +10,15 @@ function getImageUrl(image?: string | null): string {
|
|||||||
return image.includes(BASE_URL) ? image : BASE_URL + image;
|
return image.includes(BASE_URL) ? image : BASE_URL + image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ✅ axios emas, to'g'ridan-to'g'ri fetch — Next.js cache ni boshqaradi
|
||||||
const fetchAboutData = async () => {
|
const fetchAboutData = async () => {
|
||||||
const res = await partner_api.getAbout();
|
const res = await fetch(`${BASE_URL}${API_URLS.About}`, {
|
||||||
return res.data.banner;
|
cache: 'no-store', // har doim yangi ma'lumot
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) throw new Error('Failed to fetch about data');
|
||||||
|
const data = await res.json();
|
||||||
|
return data.banner;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -42,11 +46,11 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|||||||
: banner.description_en;
|
: banner.description_en;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: title,
|
title: title || 'Gastro Market',
|
||||||
description: description,
|
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||||
openGraph: {
|
openGraph: {
|
||||||
title,
|
title: title || 'Gastro Market',
|
||||||
description,
|
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||||
type: 'website',
|
type: 'website',
|
||||||
images: [
|
images: [
|
||||||
{
|
{
|
||||||
@@ -59,8 +63,8 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|||||||
},
|
},
|
||||||
twitter: {
|
twitter: {
|
||||||
card: 'summary_large_image',
|
card: 'summary_large_image',
|
||||||
title,
|
title: title || 'Gastro Market',
|
||||||
description,
|
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||||
images: [getImageUrl(banner.image)],
|
images: [getImageUrl(banner.image)],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user