34 lines
1014 B
TypeScript
34 lines
1014 B
TypeScript
import { notFound } from 'next/navigation';
|
|
import { RacesPageQuery } from '@/lib/page-queries/races/RacesPageQuery';
|
|
import { RacesPageClient } from '@/client-wrapper/RacesPageClient';
|
|
import { Metadata } from 'next';
|
|
import { MetadataHelper } from '@/lib/seo/MetadataHelper';
|
|
|
|
export const metadata: Metadata = MetadataHelper.generate({
|
|
title: 'Upcoming & Recent Races',
|
|
description: 'Stay updated with the latest sim racing action on GridPilot. View upcoming events, live race results, and detailed session reports from professional iRacing leagues.',
|
|
path: '/races',
|
|
});
|
|
|
|
export default async function Page() {
|
|
const query = new RacesPageQuery();
|
|
const result = await query.execute();
|
|
|
|
if (result.isErr()) {
|
|
const error = result.getError();
|
|
|
|
switch (error) {
|
|
case 'notFound':
|
|
notFound();
|
|
case 'redirect':
|
|
notFound();
|
|
default:
|
|
notFound();
|
|
}
|
|
}
|
|
|
|
const viewData = result.unwrap();
|
|
|
|
return <RacesPageClient viewData={viewData} />;
|
|
}
|