mirror of
https://github.com/certd/certd.git
synced 2026-07-08 21:57:36 +08:00
32 lines
626 B
TypeScript
32 lines
626 B
TypeScript
|
|
import { request } from "/@/api/service";
|
||
|
|
export type ComponentPropsType = {
|
||
|
|
type: string;
|
||
|
|
typeName: string;
|
||
|
|
action: string;
|
||
|
|
form: any;
|
||
|
|
value?: any;
|
||
|
|
};
|
||
|
|
export type RequestHandleReq<T = any> = {
|
||
|
|
type: strin;
|
||
|
|
typeName: string;
|
||
|
|
action: string;
|
||
|
|
data: any;
|
||
|
|
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;
|
||
|
|
}
|