build & pm2 start

This commit is contained in:
2025-03-21 21:05:58 +08:00
parent 6e1ada956d
commit d5b9e8eca9
13 changed files with 1351 additions and 1135 deletions

View File

@@ -1,11 +1,13 @@
import { NextRequest, NextResponse } from 'next/server';
import { getLinkDetailsById } from '@/app/api/links/service';
// 正确的Next.js 15 API路由处理函数参数类型定义
export async function GET(
request: NextRequest,
context: { params: { linkId: string } }
context: { params: Promise<any> }
) {
try {
// 获取参数,支持异步格式
const params = await context.params;
const linkId = params.linkId;
const link = await getLinkDetailsById(linkId);

View File

@@ -3,10 +3,12 @@ import { getLinkById } from '../service';
export async function GET(
request: NextRequest,
{ params }: { params: { linkId: string } }
context: { params: Promise<any> }
) {
try {
const { linkId } = params;
// 获取参数,支持异步格式
const params = await context.params;
const linkId = params.linkId;
const link = await getLinkById(linkId);
if (!link) {
@@ -18,9 +20,9 @@ export async function GET(
return NextResponse.json(link);
} catch (error) {
console.error('Failed to fetch link details:', error);
console.error('Failed to fetch link:', error);
return NextResponse.json(
{ error: 'Failed to fetch link details', message: (error as Error).message },
{ error: 'Failed to fetch link', message: (error as Error).message },
{ status: 500 }
);
}