Div. Aenderungen
This commit is contained in:
parent
ddfe087203
commit
ac5070d059
@ -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;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user