17 lines
532 B
TypeScript
17 lines
532 B
TypeScript
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
|
|
}
|