feat: bootstrap auto virtual tryon admin frontend
This commit is contained in:
28
app/api/workflows/[orderId]/route.ts
Normal file
28
app/api/workflows/[orderId]/route.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { adaptWorkflowDetail } from "@/lib/adapters/workflows";
|
||||
import { backendRequest } from "@/lib/http/backend-client";
|
||||
import {
|
||||
jsonSuccess,
|
||||
parsePositiveIntegerParam,
|
||||
withErrorHandling,
|
||||
} from "@/lib/http/response";
|
||||
import type { WorkflowStatusResponseDto } from "@/lib/types/backend";
|
||||
|
||||
type RouteContext = {
|
||||
params: Promise<{
|
||||
orderId: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
export async function GET(_request: Request, context: RouteContext) {
|
||||
return withErrorHandling(async () => {
|
||||
const { orderId: rawOrderId } = await context.params;
|
||||
const orderId = parsePositiveIntegerParam(rawOrderId, "orderId");
|
||||
const response = await backendRequest<WorkflowStatusResponseDto>(
|
||||
`/workflows/${orderId}`,
|
||||
);
|
||||
|
||||
return jsonSuccess(adaptWorkflowDetail(response.data), {
|
||||
mode: "proxy",
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user