Files
crawler-plugin/admin-frontend-vue/src/pages/records/history-feedback.ts
T

15 lines
659 B
TypeScript

/** 历史记录列表空/错误反馈(任务 125):空态文案与请求错误归一;纯逻辑。 */
import { requestErrorMessage } from '../../api/envelope.ts'
/** 空态文案(对齐 admin.js:2866 统一「暂无记录」)。 */
export function historyEmptyText(input: { hasFilter: boolean; total: number }): string {
if (typeof input.total === 'number' && input.total > 0) return ''
return '暂无记录'
}
/** 请求失败归一为可展示文案,空则回兜底。 */
export function historyErrorText(error: unknown): string {
const message = requestErrorMessage(error)
return message.trim() || '加载失败,请稍后重试'
}