diff --git a/src/components/TopBar/components/HistoryPop.vue b/src/components/TopBar/components/HistoryPop.vue index 0e65149b..1cec7007 100644 --- a/src/components/TopBar/components/HistoryPop.vue +++ b/src/components/TopBar/components/HistoryPop.vue @@ -10,7 +10,7 @@ import type { HistoryResult, List as HistoryItem } from '~/models/history/histor import { Business } from '~/models/history/history' import api from '~/utils/api' import { calcCurrentTime } from '~/utils/dataFormatter' -import { removeHttpFromUrl, scrollToTop } from '~/utils/main' +import { getCSRF, removeHttpFromUrl, scrollToTop } from '~/utils/main' const { t } = useI18n() const historys = reactive>([]) @@ -165,6 +165,17 @@ function getHistoryList(type: Business, view_at = 0 as number) { isLoading.value = false }) } + +function deleteHistoryItem(index: number, historyItem: HistoryItem) { + api.history.deleteHistoryItem({ + kid: `${historyItem.history.business}_${historyItem.history.oid}`, + csrf: getCSRF(), + }) + .then((res) => { + if (res.code === 0) + historys.splice(index, 1) + }) +}