Quellcode durchsuchen

Merge branch 'my-new-branch'

Adam Dominec vor 5 Tagen
Ursprung
Commit
a2ff8738ad
2 geänderte Dateien mit 18 neuen und 2 gelöschten Zeilen
  1. 0 0
      app/nacitani_otazek.html
  2. 18 2
      app/templates/home.html

+ 0 - 0
app/nacitani_otazek.html


+ 18 - 2
app/templates/home.html

@@ -14,6 +14,20 @@
     </style>
 </head>
 <body>
+<script>
+function quizApp() {
+    return {
+        zacalqiz: false,
+        otazky: [],
+ 
+        async startQuiz() {
+            this.zacalqiz = ! this.zacalqiz
+            const res = await fetch('/api/questions?count=5');
+            this.otazky = await res.json();
+        }
+    }
+}
+</script>
 
 <template x-if="!zacalqiz">
 <div>
@@ -249,8 +263,10 @@
 
 </div>
 </template>
-    <button @click="zacalqiz = ! zacalqiz">Toggle Content</button>
+    <button @click="startQuiz()">Toggle Content</button>
 
 </body>
 
-</html>
+</html>
+
+