Files
certd/packages/ui/certd-client/src/components/plugins/lib/index.ts
T

32 lines
628 B
TypeScript
Raw Normal View History

2024-09-27 02:15:41 +08:00
import { request } from "/@/api/service";
export type ComponentPropsType = {
type: string;
typeName: string;
action: string;
form: any;
value?: any;
};
export type RequestHandleReq<T = any> = {
2024-09-30 18:00:51 +08:00
type: string;
2024-09-27 02:15:41 +08:00
typeName: string;
action: string;
2024-09-30 18:00:51 +08:00
data?: any;
2024-09-27 02:15:41 +08:00
input: T;
};
export async function doRequest(req: RequestHandleReq) {
const url = req.type === "access" ? "/pi/handle/access" : "/pi/handle/plugin";
const { typeName, action, data, input } = req;
const res = await request({
url,
method: "post",
data: {
typeName,
action,
data,
input
}
});
return res;
}