mirror of
https://github.com/rustfs/console.git
synced 2026-10-31 12:13:27 +08:00
- Auto-format all files to comply with Prettier rules - Fix code style issues in 545 files
57 lines
962 B
TypeScript
57 lines
962 B
TypeScript
/**
|
|
* API related type definitions
|
|
*/
|
|
|
|
/**
|
|
* API error handler callback function type
|
|
*/
|
|
export type ApiErrorHandlerCallback = () => void | Promise<void>
|
|
|
|
/**
|
|
* API client error handler interface
|
|
*/
|
|
export interface IApiErrorHandler {
|
|
handle401(): Promise<void>
|
|
handle403(): Promise<void>
|
|
handleServerError(): Promise<void>
|
|
handleByStatus(status: number): Promise<void>
|
|
}
|
|
|
|
/**
|
|
* API request base configuration
|
|
*/
|
|
export interface ApiRequestConfig {
|
|
baseURL?: string
|
|
headers?: Record<string, string>
|
|
timeout?: number
|
|
}
|
|
|
|
/**
|
|
* API response base structure
|
|
*/
|
|
export interface ApiResponse<T = any> {
|
|
data?: T
|
|
message?: string
|
|
code?: number
|
|
}
|
|
|
|
/**
|
|
* Pagination request parameters
|
|
*/
|
|
export interface PaginationParams {
|
|
page?: number
|
|
pageSize?: number
|
|
offset?: number
|
|
limit?: number
|
|
}
|
|
|
|
/**
|
|
* Paginated response data
|
|
*/
|
|
export interface PaginatedResponse<T> {
|
|
items: T[]
|
|
total: number
|
|
page?: number
|
|
pageSize?: number
|
|
}
|