feat: 建立前端 TS 类型系统与 API 请求服务层
This commit is contained in:
10
frontend/src/services/productApi.ts
Normal file
10
frontend/src/services/productApi.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import api from "./api";
|
||||
import type { ProductScanResponse } from "../types/api";
|
||||
|
||||
/** 扫码查询 — 根据 16 位序列号查产品 + 顶层任务 */
|
||||
export async function scanProduct(serialNumber: string): Promise<ProductScanResponse> {
|
||||
const { data } = await api.get<ProductScanResponse>(
|
||||
`/products/scan/${encodeURIComponent(serialNumber)}`
|
||||
);
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user