30 lines
702 B
TypeScript
30 lines
702 B
TypeScript
import { apiClient } from '@/shared/api/client'
|
|
import type { ApiResponse } from '@/shared/types/types'
|
|
|
|
export interface SystemConfig {
|
|
id: number
|
|
key: string
|
|
value: string
|
|
description: string
|
|
updated_by?: number
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
|
|
export async function fetchSystemConfigs() {
|
|
const { data } =
|
|
await apiClient.get<ApiResponse<{ items: SystemConfig[] }>>('/admin/system-configs')
|
|
return data.data.items
|
|
}
|
|
|
|
export async function updateSystemConfig(
|
|
key: string,
|
|
payload: { value: string; description?: string }
|
|
) {
|
|
const { data } = await apiClient.put<ApiResponse<SystemConfig>>(
|
|
`/admin/system-configs/${key}`,
|
|
payload
|
|
)
|
|
return data.data
|
|
}
|