Fix Next.js 15 compatibility and TypeScript errors
- Update API route handlers to use async params for Next.js 15 compatibility - Fix MUI DataGrid deprecated props (pageSize -> initialState.pagination) - Replace Material-UI Grid components with Box for better compatibility - Fix admin authentication system with proper request parameters - Update permission constants to match available AdminPermission enum values - Add missing properties to Page interface for type safety - Update .gitignore to exclude venv/, import logs, and large data directories - Optimize Next.js config to reduce memory usage during builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -30,10 +30,10 @@ interface PageData {
|
||||
}
|
||||
|
||||
interface PageProps {
|
||||
params: {
|
||||
params: Promise<{
|
||||
locale: string
|
||||
slug: string
|
||||
}
|
||||
}>
|
||||
}
|
||||
|
||||
async function getPageData(slug: string): Promise<PageData | null> {
|
||||
@@ -55,7 +55,8 @@ async function getPageData(slug: string): Promise<PageData | null> {
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
||||
const page = await getPageData(params.slug)
|
||||
const resolvedParams = await params
|
||||
const page = await getPageData(resolvedParams.slug)
|
||||
|
||||
if (!page) {
|
||||
return {
|
||||
@@ -184,14 +185,15 @@ function renderContent(content: string, contentType: string) {
|
||||
}
|
||||
|
||||
export default async function PageView({ params }: PageProps) {
|
||||
const page = await getPageData(params.slug)
|
||||
const resolvedParams = await params
|
||||
const page = await getPageData(resolvedParams.slug)
|
||||
|
||||
if (!page) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
const formatDate = (dateString: string) => {
|
||||
return new Date(dateString).toLocaleDateString(params.locale, {
|
||||
return new Date(dateString).toLocaleDateString(resolvedParams.locale, {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric'
|
||||
@@ -207,7 +209,7 @@ export default async function PageView({ params }: PageProps) {
|
||||
underline="hover"
|
||||
sx={{ display: 'flex', alignItems: 'center' }}
|
||||
color="inherit"
|
||||
href={`/${params.locale}`}
|
||||
href={`/${resolvedParams.locale}`}
|
||||
>
|
||||
<HomeIcon sx={{ mr: 0.5 }} fontSize="inherit" />
|
||||
Home
|
||||
|
||||
Reference in New Issue
Block a user