This commit is contained in:
Iliyan Angelov
2025-11-25 11:16:05 +02:00
parent 4c8b71fe0d
commit 8823edc8b3
3 changed files with 39 additions and 16 deletions

View File

@@ -12,7 +12,7 @@ import ServicesInitAnimations from "@/components/pages/services/ServicesInitAnim
import { Service } from "@/lib/api/serviceService";
import { generateServiceMetadata } from "@/lib/seo/metadata";
import { ServiceSchema, BreadcrumbSchema } from "@/components/shared/seo/StructuredData";
import { API_CONFIG } from "@/lib/config/api";
import { API_CONFIG, getApiHeaders } from "@/lib/config/api";
interface ServicePageProps {
params: Promise<{
@@ -24,13 +24,13 @@ interface ServicePageProps {
// This pre-generates known pages, but new pages can still be generated on-demand
export async function generateStaticParams() {
try {
// Use internal API URL for server-side requests
const apiUrl = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:1086';
const response = await fetch(
`${API_CONFIG.BASE_URL}/api/services/`,
`${apiUrl}/api/services/`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
headers: getApiHeaders(),
next: { revalidate: 60 }, // Revalidate every minute for faster image updates
}
);
@@ -57,13 +57,13 @@ export async function generateMetadata({ params }: ServicePageProps) {
const { slug } = await params;
try {
// Use internal API URL for server-side requests
const apiUrl = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:1086';
const response = await fetch(
`${API_CONFIG.BASE_URL}/api/services/${slug}/`,
`${apiUrl}/api/services/${slug}/`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
headers: getApiHeaders(),
next: { revalidate: 60 }, // Revalidate every minute for faster image updates
}
);
@@ -87,13 +87,13 @@ const ServicePage = async ({ params }: ServicePageProps) => {
const { slug } = await params;
try {
// Use internal API URL for server-side requests
const apiUrl = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:1086';
const response = await fetch(
`${API_CONFIG.BASE_URL}/api/services/${slug}/`,
`${apiUrl}/api/services/${slug}/`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
headers: getApiHeaders(),
next: { revalidate: 60 }, // Revalidate every minute for faster image updates
}
);