mirror of
https://github.com/ZeroCatDev/ClassworksKVAdmin.git
synced 2025-12-07 18:13:09 +00:00
feat: 添加 KV 管理器功能,支持自动授权获取 Token 和键值管理
This commit is contained in:
parent
36d0da03fb
commit
dfa1c0f2f8
@ -32,6 +32,14 @@ const features = [
|
||||
color: 'from-purple-500 to-pink-500',
|
||||
iconBg: 'bg-purple-500/10',
|
||||
iconColor: 'text-purple-600 dark:text-purple-400',
|
||||
}, {
|
||||
title: 'KV 管理器',
|
||||
description: '浏览和管理键值存储数据,支持批量操作',
|
||||
icon: Database,
|
||||
path: '/kv-manager',
|
||||
color: 'from-green-500 to-emerald-500',
|
||||
iconBg: 'bg-green-500/10',
|
||||
iconColor: 'text-green-600 dark:text-green-400',
|
||||
},
|
||||
{
|
||||
title: '设备管理',
|
||||
|
||||
@ -15,6 +15,7 @@ class ApiClient {
|
||||
const data = options.body
|
||||
const params = options.params
|
||||
|
||||
try {
|
||||
// 通过 axios 实例发起请求(已内置 baseURL 与 x-site-key)
|
||||
const result = await axiosInstance.request({
|
||||
url: endpoint,
|
||||
@ -27,6 +28,14 @@ class ApiClient {
|
||||
// axios 响应拦截器已返回 response.data,这里做空值统一
|
||||
if (result === '' || result === undefined || result === null) return {}
|
||||
return result
|
||||
} catch (err) {
|
||||
// 某些后端会在非 2xx 状态下直接返回有效数据,这里兜底返回 body
|
||||
const resp = err?.response
|
||||
if (resp && resp.data !== undefined) {
|
||||
return resp.data
|
||||
}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
// 带认证的fetch
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user