36 lines
910 B
TypeScript
36 lines
910 B
TypeScript
import { http } from "@/api/http";
|
|
import type { ApiResponse } from "@/types/api";
|
|
import type {
|
|
StandardRuleCreate,
|
|
StandardRuleDetail,
|
|
StandardRuleListData,
|
|
StandardRuleUpdate,
|
|
} from "@/types/standards";
|
|
|
|
export function fetchStandards(params: {
|
|
keyword?: string;
|
|
category?: string;
|
|
status?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
}) {
|
|
return http.get<ApiResponse<StandardRuleListData>>("/v1/standards", {
|
|
params,
|
|
});
|
|
}
|
|
|
|
export function fetchStandard(ruleId: number) {
|
|
return http.get<ApiResponse<StandardRuleDetail>>(`/v1/standards/${ruleId}`);
|
|
}
|
|
|
|
export function createStandard(payload: StandardRuleCreate) {
|
|
return http.post<ApiResponse<StandardRuleDetail>>("/v1/standards", payload);
|
|
}
|
|
|
|
export function updateStandard(ruleId: number, payload: StandardRuleUpdate) {
|
|
return http.patch<ApiResponse<StandardRuleDetail>>(
|
|
`/v1/standards/${ruleId}`,
|
|
payload,
|
|
);
|
|
}
|