update
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
toom1996
2026-09-06 00:50:52 +08:00
parent 36f3ad039f
commit 19fb597bb4
20 changed files with 497 additions and 548 deletions

View File

@ -78,7 +78,7 @@ export function recordHistory(id: string): void {
setLocal(list)
if (serverMode()) {
authJson("POST", "/auth/history", { target_uid: id }).catch(() => {
authJson("POST", "/me/history", { target_uid: id }).catch(() => {
/* 失败不回滚本地 */
})
}
@ -102,7 +102,7 @@ export async function fetchHistoryPage(page = 1, perPage = 24): Promise<HistPage
const qs = `page=${page}&per_page=${perPage}`
const r = await authJson<{ items: ServerHistory[]; total: number; last_page: number }>(
"GET",
`/auth/history?${qs}`,
`/me/history?${qs}`,
)
const base: HistoryEntry[] = (r?.items ?? []).map((it) => ({
id: String(it.id),
@ -131,7 +131,7 @@ export async function fetchHistoryPage(page = 1, perPage = 24): Promise<HistPage
export function removeHistory(id: string): void {
setLocal(getLocal().filter((h) => h.id !== id))
if (serverMode()) {
authJson("DELETE", `/auth/history/${encodeURIComponent(id)}`).catch(() => {
authJson("DELETE", `/me/history/${encodeURIComponent(id)}`).catch(() => {
/* 失败不回滚本地 */
})
}
@ -141,7 +141,7 @@ export function removeHistory(id: string): void {
export function clearHistory(): void {
setLocal([])
if (serverMode()) {
authJson("DELETE", "/auth/history").catch(() => {
authJson("DELETE", "/me/history").catch(() => {
/* 失败不回滚本地 */
})
}