mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 19:36:36 +08:00
fix: stabilize library paths and subscription matching
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { api } from './client'
|
||||
|
||||
export interface RecognitionWordsConfig {
|
||||
enabled: boolean
|
||||
local_text: string
|
||||
shared_urls: string[]
|
||||
shared_text?: string
|
||||
synced_at?: string
|
||||
rule_count: number
|
||||
}
|
||||
|
||||
export interface RecognitionWordsTestResult {
|
||||
input: string
|
||||
output: string
|
||||
title: string
|
||||
year: number
|
||||
changed: boolean
|
||||
}
|
||||
|
||||
export const recognitionWordsAPI = {
|
||||
get: () => api.get<RecognitionWordsConfig>('/admin/recognition-words').then((r) => r.data),
|
||||
|
||||
save: (payload: RecognitionWordsConfig) =>
|
||||
api.put<RecognitionWordsConfig>('/admin/recognition-words', payload).then((r) => r.data),
|
||||
|
||||
sync: () => api.post<RecognitionWordsConfig>('/admin/recognition-words/sync').then((r) => r.data),
|
||||
|
||||
test: (input: string) =>
|
||||
api.post<RecognitionWordsTestResult>('/admin/recognition-words/test', { input }).then((r) => r.data),
|
||||
}
|
||||
@@ -42,10 +42,14 @@ export function buildSubscriptionAliases(item: {
|
||||
|
||||
export const subscriptionsAPI = {
|
||||
list: () =>
|
||||
api.get<{ items: Subscription[] }>('/subscriptions').then((r) => r.data.items),
|
||||
api
|
||||
.get<{ items: Subscription[] }>('/subscriptions', subscriptionListRequestConfig())
|
||||
.then((r) => r.data.items),
|
||||
|
||||
history: () =>
|
||||
api.get<{ items: Subscription[] }>('/subscriptions/history').then((r) => r.data.items),
|
||||
api
|
||||
.get<{ items: Subscription[] }>('/subscriptions/history', subscriptionListRequestConfig())
|
||||
.then((r) => r.data.items),
|
||||
|
||||
create: (input: {
|
||||
name: string
|
||||
@@ -86,3 +90,10 @@ export const subscriptionsAPI = {
|
||||
runNow: (id: string) =>
|
||||
api.post<{ queued: number }>(`/subscriptions/${id}/run`).then((r) => r.data),
|
||||
}
|
||||
|
||||
function subscriptionListRequestConfig() {
|
||||
return {
|
||||
headers: { 'Cache-Control': 'no-cache' },
|
||||
params: { _ts: Date.now() },
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user