frontPanel/src/stores/quizes/hooks.ts

12 lines
273 B
TypeScript
Raw Normal View History

2023-11-14 13:37:20 +00:00
import { useQuizStore } from "./store";
2023-11-13 18:04:51 +00:00
export function useCurrentQuiz() {
2023-11-14 13:37:20 +00:00
const quizId = useQuizStore(state => state.editQuizId);
2023-11-27 23:07:24 +00:00
const quizes = useQuizStore(state => state.quizes);
2023-11-13 18:04:51 +00:00
2023-11-27 23:07:24 +00:00
const quiz = quizes.find(q => q.backendId === quizId);
2023-11-14 13:10:41 +00:00
2023-11-27 23:07:24 +00:00
return quiz;
2023-11-13 18:04:51 +00:00
}