refactor: standardize code formatting and improve consistency across various components and API routes for enhanced readability and maintainability
This commit is contained in:
@@ -23,7 +23,7 @@ export async function GET(request: NextRequest) {
|
||||
console.error("Error fetching accounts:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to fetch accounts" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export async function POST(request: Request) {
|
||||
console.error("Error creating account:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to create account" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ export async function PUT(request: Request) {
|
||||
console.error("Error updating account:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to update account" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export async function DELETE(request: Request) {
|
||||
if (accountIds.length === 0) {
|
||||
return NextResponse.json(
|
||||
{ error: "At least one account ID is required" },
|
||||
{ status: 400 }
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
await accountService.deleteMany(accountIds);
|
||||
@@ -116,14 +116,14 @@ export async function DELETE(request: Request) {
|
||||
headers: {
|
||||
"Cache-Control": "no-store",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{ error: "Account ID is required" },
|
||||
{ status: 400 }
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -141,13 +141,13 @@ export async function DELETE(request: Request) {
|
||||
headers: {
|
||||
"Cache-Control": "no-store",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error deleting account:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to delete account" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user