fix
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
// 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 { AboutHero } from '@/features/about/ui/AboutHero';
|
||||
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';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ✅ axios emas, to'g'ridan-to'g'ri fetch — Next.js cache ni boshqaradi
|
||||
const fetchAboutData = async () => {
|
||||
const res = await partner_api.getAbout();
|
||||
return res.data.banner;
|
||||
const res = await fetch(`${BASE_URL}${API_URLS.About}`, {
|
||||
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 {
|
||||
@@ -42,11 +46,11 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
: banner.description_en;
|
||||
|
||||
return {
|
||||
title: title,
|
||||
description: description,
|
||||
title: title || 'Gastro Market',
|
||||
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
title: title || 'Gastro Market',
|
||||
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||
type: 'website',
|
||||
images: [
|
||||
{
|
||||
@@ -59,8 +63,8 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
title,
|
||||
description,
|
||||
title: title || 'Gastro Market',
|
||||
description: description || 'Gastro Market mahsulotlarini kashf eting',
|
||||
images: [getImageUrl(banner.image)],
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user