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

33 lines
658 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;
};
2024-10-03 01:29:12 +08:00
export async function doRequest(req: RequestHandleReq, opts?: any = {}) {
2024-09-27 02:15:41 +08:00
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
2024-10-03 01:29:12 +08:00
},
...opts
2024-09-27 02:15:41 +08:00
});
return res;
}