refactor(token): 优化令牌详情页面的数据获取逻辑
部署开发环境 / deploy-dev (push) Successful in 2m2s

- 移除 fetchInfo 函数中的加载状态管理
- 将 loading 状态管理移到 refresh 函数中
- 为 refresh 函数添加异步支持和加载状态显示
- 保留数据获取成功后的消息提示功能
- 简化了请求处理流程并改善用户体验
This commit is contained in:
2026-06-03 13:43:32 +08:00
parent a725b56ab2
commit 026ba10bb7
+5 -7
View File
@@ -22,8 +22,7 @@ const isLoading = ref(false)
const fetchInfo = async () => {
if (!value.value) return
loading.value = true
try {
const res = await axios.get('/api/token/info', {
params: {
token: value.value
@@ -33,9 +32,6 @@ const fetchInfo = async () => {
result.value = res.data.result
lastUpdate.value = new Date().toLocaleTimeString()
}
} finally {
loading.value = false
}
}
const fetchTokens = async () => {
@@ -49,8 +45,10 @@ const fetchTokens = async () => {
}
}
const refresh = () => {
fetchInfo()
const refresh = async () => {
loading.value = true
await fetchInfo()
loading.value = false
ElMessage({message: '刷新成功', type: 'success', duration: 1500})
}