// app/visa/page.tsx import Breadcrumb from "../components/Breadcrumb"; import { fetchVisaData, type VisaCountry } from "@/api/visa"; // Force dynamic rendering - không cache export const dynamic = 'force-dynamic'; export default async function VisaListPage() { // Fetch all visa countries từ API let visaCountries: any[] = []; let visaHero: any = {}; const visaTitle = "Visa Services"; const breadcrumbCurrent = "Visa Services"; let error: string | null = null; try { const visaData = await fetchVisaData(); visaCountries = visaData.hero.summaryList.map((country: VisaCountry) => ({ ...country, icon: country.icon, })); visaHero = visaData.hero; } catch (err) { const errorMessage = err instanceof Error ? err.message : String(err); console.error("Error fetching visa countries:", errorMessage); error = errorMessage; } // Fallback message nếu có error if (error && visaCountries.length === 0) { return ( <> Error loading visa services: {error} > ); } return ( <> {/* Breadcrumb-Wrapper Section Start */} {/* Service Section Start */} {visaCountries.map((country) => ( Visa Service {country.name} {/* Read More Button */} Read More {/* Services List */} {/* First Column */} {country.services[0] && ( {country.services[0]} )} {country.services[1] && ( {country.services[1]} )} {/* Second Column */} {country.services[2] && ( {country.services[2]} )} {country.services[3] && ( {country.services[3]} )} ))} > ); }
Error loading visa services: {error}
Visa Service