修复若干问题
This commit is contained in:
1 parent
c8cdf9a7bc
commit
bf083523c8
12 files changed
+581
-40
No files matched your search
@@ -44,17 +44,12 @@ export async function PUT(request: NextRequest) {
|
||||
if (!oldUrl) {
|
||||
return NextResponse.json({ error: "oldUrl is required" }, { status: 400 });
|
||||
}
|
||||
// If URL changed, delete old and create new
|
||||
if (newUrl && newUrl !== oldUrl) {
|
||||
await deleteLink(oldUrl);
|
||||
await addLink({ name: name || "", url: newUrl, description, hidden });
|
||||
} else {
|
||||
const data: Record<string, unknown> = {};
|
||||
if (name !== undefined) data.name = name;
|
||||
if (description !== undefined) data.description = description;
|
||||
if (hidden !== undefined) data.hidden = hidden;
|
||||
await updateLink(oldUrl, data);
|
||||
}
|
||||
const data: Record<string, unknown> = {};
|
||||
if (name !== undefined) data.name = name;
|
||||
if (description !== undefined) data.description = description;
|
||||
if (hidden !== undefined) data.hidden = hidden;
|
||||
if (newUrl !== undefined) data.url = newUrl;
|
||||
await updateLink(oldUrl, data);
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (error: unknown) {
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in new issue
Block a user