()
| 59 | }); |
| 60 | } |
| 61 | async function onCleanHistoryLog() { |
| 62 | try { |
| 63 | setLoadingCleanHistoryLog(true); |
| 64 | if (!inputs.historyTimestamp) throw new Error(t('请选择日志记录时间')); |
| 65 | const res = await API.delete( |
| 66 | `/api/log/?target_timestamp=${Date.parse(inputs.historyTimestamp) / 1000}`, |
| 67 | ); |
| 68 | const { success, message, data } = res.data; |
| 69 | if (success) { |
| 70 | showSuccess(`${data} ${t('条日志已清理!')}`); |
| 71 | return; |
| 72 | } else { |
| 73 | throw new Error(t('日志清理失败:') + message); |
| 74 | } |
| 75 | } catch (error) { |
| 76 | showError(error.message); |
| 77 | } finally { |
| 78 | setLoadingCleanHistoryLog(false); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | useEffect(() => { |
| 83 | const currentInputs = {}; |
nothing calls this directly
no test coverage detected