fix: migrate the codebase from Next.js 14 to Next.js 15
All checks were successful
Deploy Next.js application / deploy (push) Successful in 8m5s
All checks were successful
Deploy Next.js application / deploy (push) Successful in 8m5s
This commit is contained in:
parent
637fa7d7b1
commit
a4cadaac3a
13 changed files with 60 additions and 34 deletions
|
@ -1,5 +1,5 @@
|
||||||
"use client";
|
"use client";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState, use } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
|
@ -10,7 +10,8 @@ const MarkdownEditor = dynamic(() => import("@uiw/react-md-editor"), {
|
||||||
ssr: false
|
ssr: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const EditPage = ({ params }: { params: { slug: string } }) => {
|
const EditPage = (props: { params: Promise<{ slug: string }> }) => {
|
||||||
|
const params = use(props.params);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { slug } = params;
|
const { slug } = params;
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
|
|
@ -49,11 +49,10 @@ interface BlogSlugArticle {
|
||||||
|
|
||||||
export const dynamic = "force-static";
|
export const dynamic = "force-static";
|
||||||
|
|
||||||
export async function generateMetadata({
|
export async function generateMetadata(props: {
|
||||||
params
|
params: Promise<{ slug: string }>;
|
||||||
}: {
|
|
||||||
params: { slug: string };
|
|
||||||
}): Promise<Metadata> {
|
}): Promise<Metadata> {
|
||||||
|
const params = await props.params;
|
||||||
const data = await getData(params.slug);
|
const data = await getData(params.slug);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
@ -145,11 +144,10 @@ const customPortableTextComponents: PortableTextComponents = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function BlogSlugArticle({
|
export default async function BlogSlugArticle(props: {
|
||||||
params
|
params: Promise<{ slug: string }>;
|
||||||
}: {
|
|
||||||
params: { slug: string };
|
|
||||||
}) {
|
}) {
|
||||||
|
const params = await props.params;
|
||||||
const data: BlogSlugArticle = await getData(params.slug);
|
const data: BlogSlugArticle = await getData(params.slug);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|
|
@ -38,7 +38,8 @@ export const metadata: Metadata = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const BlogPage = async ({ params }: { params: { id: string } }) => {
|
const BlogPage = async (props: { params: Promise<{ id: string }> }) => {
|
||||||
|
const params = await props.params;
|
||||||
// Optionally, you can fetch some initial data here if needed.
|
// Optionally, you can fetch some initial data here if needed.
|
||||||
let id = parseInt(params.id);
|
let id = parseInt(params.id);
|
||||||
if (isNaN(id)) id = 1;
|
if (isNaN(id)) id = 1;
|
||||||
|
|
|
@ -7,11 +7,10 @@ interface Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
// baseURL [ENV]
|
// baseURL [ENV]
|
||||||
export async function generateMetadata({
|
export async function generateMetadata(props: {
|
||||||
params
|
params: Promise<{ slug: "string" }>;
|
||||||
}: {
|
|
||||||
params: { slug: "string" };
|
|
||||||
}) {
|
}) {
|
||||||
|
const params = await props.params;
|
||||||
let page: Page = {
|
let page: Page = {
|
||||||
title: "unknown mod",
|
title: "unknown mod",
|
||||||
content: "unknown mod"
|
content: "unknown mod"
|
||||||
|
|
|
@ -12,7 +12,8 @@ interface Page {
|
||||||
|
|
||||||
export const dynamic = "force-static";
|
export const dynamic = "force-static";
|
||||||
|
|
||||||
const Page = async ({ params }: { params: { slug: string } }) => {
|
const Page = async (props: { params: Promise<{ slug: string }> }) => {
|
||||||
|
const params = await props.params;
|
||||||
const { slug } = params;
|
const { slug } = params;
|
||||||
let page: Page | null = null;
|
let page: Page | null = null;
|
||||||
let isNotFound = false;
|
let isNotFound = false;
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
"use client";
|
"use client";
|
||||||
import Newsletter from "@/components/shared/Newsletter";
|
import Newsletter from "@/components/shared/Newsletter";
|
||||||
import React, { useState } from "react";
|
import React, { useState, use } from "react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { useToast } from "@/components/ui/use-toast";
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
import HCaptcha from "@hcaptcha/react-hcaptcha";
|
import HCaptcha from "@hcaptcha/react-hcaptcha";
|
||||||
|
|
||||||
const UnsubscribePage = ({
|
const UnsubscribePage = (props: {
|
||||||
searchParams
|
searchParams: Promise<{ id: string | undefined }>;
|
||||||
}: {
|
|
||||||
searchParams: { id: string | undefined };
|
|
||||||
}) => {
|
}) => {
|
||||||
|
const searchParams = use(props.searchParams);
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [showCaptcha, setShowCaptcha] = useState(false);
|
const [showCaptcha, setShowCaptcha] = useState(false);
|
||||||
|
|
|
@ -6,8 +6,9 @@ import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { id: string } }
|
props: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -6,8 +6,9 @@ import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { id: string } }
|
props: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -6,8 +6,9 @@ import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { id: string } }
|
props: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -5,8 +5,9 @@ import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { id: string } }
|
props: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
|
|
@ -4,8 +4,9 @@ import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { slug: string } }
|
props: { params: Promise<{ slug: string }> }
|
||||||
) => {
|
) => {
|
||||||
|
const params = await props.params;
|
||||||
const client = await clientPromise;
|
const client = await clientPromise;
|
||||||
const db = client.db(process.env.MONGODB_DB);
|
const db = client.db(process.env.MONGODB_DB);
|
||||||
const { slug } = params;
|
const { slug } = params;
|
||||||
|
@ -25,8 +26,9 @@ export const GET = async (
|
||||||
|
|
||||||
export const PUT = async (
|
export const PUT = async (
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { slug: string } }
|
props: { params: Promise<{ slug: string }> }
|
||||||
) => {
|
) => {
|
||||||
|
const params = await props.params;
|
||||||
const client = await clientPromise;
|
const client = await clientPromise;
|
||||||
const db = client.db(process.env.MONGODB_DB);
|
const db = client.db(process.env.MONGODB_DB);
|
||||||
const { slug } = params;
|
const { slug } = params;
|
||||||
|
@ -78,8 +80,9 @@ export const PUT = async (
|
||||||
|
|
||||||
export const DELETE = async (
|
export const DELETE = async (
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { slug: string } }
|
props: { params: Promise<{ slug: string }> }
|
||||||
) => {
|
) => {
|
||||||
|
const params = await props.params;
|
||||||
const client = await clientPromise;
|
const client = await clientPromise;
|
||||||
const db = client.db(process.env.MONGODB_DB);
|
const db = client.db(process.env.MONGODB_DB);
|
||||||
const { slug } = params;
|
const { slug } = params;
|
||||||
|
|
|
@ -7,8 +7,9 @@ export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export async function PUT(
|
export async function PUT(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: { id: string } }
|
props: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
|
const params = await props.params;
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
const { fileName, version, downloadLink, fileSize } = body;
|
const { fileName, version, downloadLink, fileSize } = body;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
@ -18,9 +22,24 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": [
|
||||||
}
|
"./*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"target": "ES2017"
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "lib/Hoc/withAuth.jsx" , "**/*.mdx", "pages/_app.tsx", "hashedpass.s", "app/(root)/contact"],
|
"include": [
|
||||||
"exclude": ["node_modules"]
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts",
|
||||||
|
"lib/Hoc/withAuth.jsx",
|
||||||
|
"**/*.mdx",
|
||||||
|
"pages/_app.tsx",
|
||||||
|
"hashedpass.s",
|
||||||
|
"app/(root)/contact"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue