Files
TERES_web_frontend/src/interfaces/database/base.ts

42 lines
976 B
TypeScript
Raw Normal View History

/**
*
* API响应的标准格式
* @template T any
*/
export interface ResponseType<T = any> {
/** 响应状态码 */
code: number;
/** 响应数据 */
data: T;
/** 响应消息 */
message: string;
/** HTTP状态码 */
status: number;
}
/**
* GET请求响应类型接口
* GET请求的响应数据结构
* @template T any
*/
export interface ResponseGetType<T = any> {
/** 响应数据 */
data: T;
/** 加载状态,可选字段 */
loading?: boolean;
}
/**
* POST请求响应类型接口
* POST请求的响应数据结构
* @template T any
*/
export interface ResponsePostType<T = any> {
/** 响应数据 */
data: T;
/** 加载状态,可选字段 */
loading?: boolean;
/** 其他扩展字段,键为字符串,值为未知类型 */
[key: string]: unknown;
}