refactor: introduce repositories and expose study api client

This commit is contained in:
2026-02-27 11:19:13 +08:00
parent eb88494c5a
commit 9a5e8cb58f
5 changed files with 160 additions and 45 deletions

View File

@@ -2,3 +2,4 @@ export * from './types'
export * from './stats'
export * from './words'
export * from './review'
export * from './study'

View File

@@ -0,0 +1,16 @@
import { http } from '../http'
import type { ReviewMode, ReviewResult, Word } from './types'
export async function createStudySession(limit = 10) {
const res = await http.post<{ data: Word[] }>('/study/sessions', { limit })
return res.data
}
export async function submitStudyAnswer(payload: { wordId: number; answer: string; mode: ReviewMode }) {
const res = await http.post<{ data: ReviewResult }>('/study/answers', {
word_id: payload.wordId,
answer: payload.answer,
mode: payload.mode
})
return res.data
}