29 lines
837 B
TypeScript
29 lines
837 B
TypeScript
import { BaseService } from '../BaseService'
|
|
import type { BaseResponse } from '@/types/api'
|
|
import type {
|
|
SystemConfigItem,
|
|
SystemConfigPageResult,
|
|
SystemConfigQueryParams,
|
|
UpdateSystemConfigRequest
|
|
} from '@/types/api/systemConfig'
|
|
|
|
const SYSTEM_CONFIG_BASE_URL = '/api/admin/system-configs'
|
|
|
|
export class SystemConfigService extends BaseService {
|
|
static getSystemConfigs(
|
|
params?: SystemConfigQueryParams
|
|
): Promise<BaseResponse<SystemConfigPageResult>> {
|
|
return this.get<BaseResponse<SystemConfigPageResult>>(SYSTEM_CONFIG_BASE_URL, params)
|
|
}
|
|
|
|
static updateSystemConfig(
|
|
key: string,
|
|
data: UpdateSystemConfigRequest
|
|
): Promise<BaseResponse<SystemConfigItem>> {
|
|
return this.put<BaseResponse<SystemConfigItem>>(
|
|
`${SYSTEM_CONFIG_BASE_URL}/${encodeURIComponent(key)}`,
|
|
data
|
|
)
|
|
}
|
|
}
|