refactor(api): 重命名搜索历史相关 API 方法

This commit is contained in:
jmal 2025-04-28 14:38:09 +08:00
parent 007475bce6
commit 5a12e800c0
2 changed files with 4 additions and 4 deletions

View File

@ -138,7 +138,7 @@ export default {
}) })
}, },
// 最近搜索记录🔍 // 最近搜索记录🔍
recentlySearchHistory: function(params) { getRecentlySearchHistory: function(params) {
return request({ return request({
url: '/search/recentlySearchHistory', url: '/search/recentlySearchHistory',
method: 'get', method: 'get',
@ -146,7 +146,7 @@ export default {
}) })
}, },
// 删除搜索记录🔍 // 删除搜索记录🔍
deleteSearchHistory: function(params) { removeSearchHistory: function(params) {
return request({ return request({
url: '/search/deleteSearchHistory', url: '/search/deleteSearchHistory',
method: 'delete', method: 'delete',

View File

@ -4550,7 +4550,7 @@ export default {
cb([]) cb([])
return return
} }
api.recentlySearchHistory({keyword: queryString}).then(res => { api.getRecentlySearchHistory({keyword: queryString}).then(res => {
this.searchHistoryList = res.data || [] this.searchHistoryList = res.data || []
cb(this.searchHistoryList) cb(this.searchHistoryList)
}).catch(error => { }).catch(error => {
@ -4569,7 +4569,7 @@ export default {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
const idToDelete = itemToDelete.id const idToDelete = itemToDelete.id
api.deleteSearchHistory({id: idToDelete}).then(() => { api.removeSearchHistory({id: idToDelete}).then(() => {
const index = this.searchHistoryList.findIndex(item => item.id === idToDelete) const index = this.searchHistoryList.findIndex(item => item.id === idToDelete)
this.searchHistoryList.splice(index, 1) this.searchHistoryList.splice(index, 1)
}) })