website refactor
This commit is contained in:
@@ -1,9 +1,33 @@
|
||||
import { SponsorshipRequestsTemplate } from '@/templates/SponsorshipRequestsTemplate';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { SponsorshipRequestsPageQuery } from '@/lib/page-queries/page-queries/SponsorshipRequestsPageQuery';
|
||||
import { SponsorshipRequestsClient } from './SponsorshipRequestsClient';
|
||||
import { acceptSponsorshipRequest, rejectSponsorshipRequest } from './actions';
|
||||
|
||||
export default async function SponsorshipRequestsPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Record<string, string>;
|
||||
}) {
|
||||
return <SponsorshipRequestsTemplate searchParams={searchParams} />;
|
||||
export default async function SponsorshipRequestsPage() {
|
||||
// Execute PageQuery
|
||||
const queryResult = await SponsorshipRequestsPageQuery.execute();
|
||||
|
||||
if (queryResult.isErr()) {
|
||||
const error = queryResult.getError();
|
||||
|
||||
if (error === 'notFound') {
|
||||
notFound();
|
||||
} else if (error === 'redirect') {
|
||||
// In a real implementation, you'd use redirect('/')
|
||||
notFound();
|
||||
} else {
|
||||
// For other errors, show notFound for now
|
||||
notFound();
|
||||
}
|
||||
}
|
||||
|
||||
const viewData = queryResult.unwrap();
|
||||
|
||||
return (
|
||||
<SponsorshipRequestsClient
|
||||
viewData={viewData}
|
||||
onAccept={acceptSponsorshipRequest}
|
||||
onReject={rejectSponsorshipRequest}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user