refactor(route): update parameter handling in PATCH function for improved readability
This commit is contained in:
@@ -12,10 +12,11 @@ async function getAuthHeaders(): Promise<Record<string, string>> {
|
|||||||
|
|
||||||
export async function PATCH(
|
export async function PATCH(
|
||||||
req: Request,
|
req: Request,
|
||||||
{ params }: { params: { id: string } },
|
{ params }: { params: Promise<{ id: string }> },
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const productId = parseInt(params.id, 10);
|
const { id } = await params;
|
||||||
|
const productId = parseInt(id, 10);
|
||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
const { categoryId } = body;
|
const { categoryId } = body;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user