Files
TrueGrowth/vendor/aigcpanel/electron/lib/api.ts
Jammy 52636c91ae
Some checks failed
CI / main (push) Has been cancelled
CI / release-e2e (push) Has been cancelled
Track bundled vendor runtime sources
2026-07-07 10:05:50 +08:00

26 lines
631 B
TypeScript

import Apps from "../mapi/app";
export type ResultType<T> = {
// should follow the rules:
// <0 business error
// =0 success
// 10000 error ( network error, server error, etc. )
code: number;
msg: string;
data?: T;
};
export const post = async (url: string, data: any) => {
data = data || {};
const userAgent = Apps.getUserAgent();
data["AppManagerUserAgent"] = userAgent;
return await fetch(url, {
method: "POST",
headers: {
"User-Agent": userAgent,
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
};