Neue Version
This commit is contained in:
@@ -12,10 +12,6 @@ export default function QuizPage({ mode, onBack, customQuestions }) {
|
||||
const [answerStatus, setAnswerStatus] = useState([]); // "correct" | "wrong" | undefined
|
||||
|
||||
|
||||
//API BAse
|
||||
const API_BASE = "https://api.schiri.marc-wieland.de"; // oder dein Backend-Service
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const savedQuestions = sessionStorage.getItem("quiz_questions");
|
||||
const savedIndex = sessionStorage.getItem("quiz_current_idx");
|
||||
@@ -23,6 +19,8 @@ useEffect(() => {
|
||||
const savedWrong = sessionStorage.getItem("quiz_wrong_questions");
|
||||
const savedStatus = sessionStorage.getItem("quiz_answer_status");
|
||||
|
||||
|
||||
|
||||
if (savedQuestions) {
|
||||
setQuestions(JSON.parse(savedQuestions));
|
||||
setCurrentIdx(parseInt(savedIndex) || 0);
|
||||
@@ -36,7 +34,7 @@ useEffect(() => {
|
||||
setQuestions(customQuestions);
|
||||
sessionStorage.setItem("quiz_questions", JSON.stringify(customQuestions));
|
||||
} else {
|
||||
fetch(`${API_BASE}/api/questions/${mode}`)
|
||||
fetch(`/api/questions/${mode}`)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
const shuffled = data.sort(() => 0.5 - Math.random()).slice(0, 30);
|
||||
|
||||
Reference in New Issue
Block a user