50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
import axios from 'axios'
|
|
|
|
// 相对路径(由同源 Go 搜索服务器提供),不指定端口
|
|
const BASE = ''
|
|
|
|
export async function fetchRecent(limit = 50) {
|
|
const { data } = await axios.get(`${BASE}/admin/recent`, {
|
|
params: { limit },
|
|
timeout: 15000,
|
|
})
|
|
return data
|
|
}
|
|
|
|
export async function fetchStats() {
|
|
const { data } = await axios.get(`${BASE}/admin/stats`, {
|
|
timeout: 15000,
|
|
})
|
|
return data
|
|
}
|
|
|
|
export async function fetchPriority() {
|
|
const { data } = await axios.get(`${BASE}/admin/priority`, {
|
|
timeout: 15000,
|
|
})
|
|
return data
|
|
}
|
|
|
|
export async function addPriority(url) {
|
|
const { data } = await axios.post(`${BASE}/admin/priority`, { url }, {
|
|
timeout: 15000,
|
|
})
|
|
return data
|
|
}
|
|
|
|
export async function removePriority(url) {
|
|
const { data } = await axios.delete(`${BASE}/admin/priority`, {
|
|
params: { url },
|
|
timeout: 15000,
|
|
})
|
|
return data
|
|
}
|
|
|
|
export async function flushIndex() {
|
|
const { data } = await axios.post(`${BASE}/admin/flush`, null, {
|
|
timeout: 60000,
|
|
})
|
|
return data
|
|
}
|
|
|