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 category stats:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to fetch category stats" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export async function POST(request: Request) {
|
||||
console.error("Error creating category:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to create category" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export async function PUT(request: Request) {
|
||||
console.error("Error updating category:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to update category" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ export async function DELETE(request: Request) {
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{ error: "Category ID is required" },
|
||||
{ status: 400 }
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -112,13 +112,13 @@ export async function DELETE(request: Request) {
|
||||
headers: {
|
||||
"Cache-Control": "no-store",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error deleting category:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "Failed to delete category" },
|
||||
{ status: 500 }
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user