Div. Aenderungen

This commit is contained in:
MarcWieland 2025-07-25 01:42:20 +02:00
parent ddfe087203
commit ac5070d059
2 changed files with 14 additions and 1 deletions

View File

@ -14,4 +14,12 @@ server {
access_log off; access_log off;
add_header Cache-Control "public"; add_header Cache-Control "public";
} }
location /api/ {
proxy_pass http://backend:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
} }
}

View File

@ -11,6 +11,11 @@ export default function QuizPage({ mode, onBack, customQuestions }) {
const [refreshKey, setRefreshKey] = useState(0); const [refreshKey, setRefreshKey] = useState(0);
const [answerStatus, setAnswerStatus] = useState([]); // "correct" | "wrong" | undefined const [answerStatus, setAnswerStatus] = useState([]); // "correct" | "wrong" | undefined
//API BAse
const API_BASE = "https://api.schiri.marc-wieland.de"; // oder dein Backend-Service
useEffect(() => { useEffect(() => {
const savedQuestions = sessionStorage.getItem("quiz_questions"); const savedQuestions = sessionStorage.getItem("quiz_questions");
const savedIndex = sessionStorage.getItem("quiz_current_idx"); const savedIndex = sessionStorage.getItem("quiz_current_idx");
@ -31,7 +36,7 @@ useEffect(() => {
setQuestions(customQuestions); setQuestions(customQuestions);
sessionStorage.setItem("quiz_questions", JSON.stringify(customQuestions)); sessionStorage.setItem("quiz_questions", JSON.stringify(customQuestions));
} else { } else {
fetch(`/api/questions/${mode}`) fetch(`${API_BASE}/api/questions/${mode}`)
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((data) => {
const shuffled = data.sort(() => 0.5 - Math.random()).slice(0, 30); const shuffled = data.sort(() => 0.5 - Math.random()).slice(0, 30);