Initial clean project import
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user