UNPKG

@hcapp01/quiz-data

Version:

quiz-data

18 lines (16 loc) 576 B
```tsx import { createLearner, getQuizFetcher } from '@hcapp01/quiz-data'; import type { SinoContent } from '@hcapp01/quiz-data'; const {learnerId, token} = await createLearner(); const fetcher = await getQuizFetcher(learnerId, token); if (fetcher) { fetcher.moveToNextPhase(); const progress = fetcher.toJson(); console.log('fetcher', progress); const unit = fetcher.getUnitStatus(); const quiz = fetcher.getNextQuiz(); if (quiz) { fetcher.submitQuizResult(quiz.content.text, quiz.quizType, Score.Pass); saveQuizFetcher(learnerId, token, fetcher); } }