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',
|
color: 'from-purple-500 to-pink-500',
|
||||||
iconBg: 'bg-purple-500/10',
|
iconBg: 'bg-purple-500/10',
|
||||||
iconColor: 'text-purple-600 dark:text-purple-400',
|
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: '设备管理',
|
title: '设备管理',
|
||||||
|
|||||||
@ -15,18 +15,27 @@ class ApiClient {
|
|||||||
const data = options.body
|
const data = options.body
|
||||||
const params = options.params
|
const params = options.params
|
||||||
|
|
||||||
// 通过 axios 实例发起请求(已内置 baseURL 与 x-site-key)
|
try {
|
||||||
const result = await axiosInstance.request({
|
// 通过 axios 实例发起请求(已内置 baseURL 与 x-site-key)
|
||||||
url: endpoint,
|
const result = await axiosInstance.request({
|
||||||
method,
|
url: endpoint,
|
||||||
headers,
|
method,
|
||||||
data,
|
headers,
|
||||||
params,
|
data,
|
||||||
})
|
params,
|
||||||
|
})
|
||||||
|
|
||||||
// axios 响应拦截器已返回 response.data,这里做空值统一
|
// axios 响应拦截器已返回 response.data,这里做空值统一
|
||||||
if (result === '' || result === undefined || result === null) return {}
|
if (result === '' || result === undefined || result === null) return {}
|
||||||
return result
|
return result
|
||||||
|
} catch (err) {
|
||||||
|
// 某些后端会在非 2xx 状态下直接返回有效数据,这里兜底返回 body
|
||||||
|
const resp = err?.response
|
||||||
|
if (resp && resp.data !== undefined) {
|
||||||
|
return resp.data
|
||||||
|
}
|
||||||
|
throw err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 带认证的fetch
|
// 带认证的fetch
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user