diff --git a/frontend/src/lib/components/codemirror/codemirror.svelte b/frontend/src/lib/components/codemirror/codemirror.svelte
index e0259e8..8725fe3 100644
--- a/frontend/src/lib/components/codemirror/codemirror.svelte
+++ b/frontend/src/lib/components/codemirror/codemirror.svelte
@@ -1,17 +1,17 @@
- -->
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte
index a980213..2976d54 100644
--- a/frontend/src/routes/+page.svelte
+++ b/frontend/src/routes/+page.svelte
@@ -6,7 +6,6 @@
const _identity = get(identity);
-
Probo
diff --git a/frontend/src/routes/dashboard/+page.server.ts b/frontend/src/routes/dashboard/+page.server.ts
new file mode 100644
index 0000000..238d7ea
--- /dev/null
+++ b/frontend/src/routes/dashboard/+page.server.ts
@@ -0,0 +1,24 @@
+type Question = {
+ text: string;
+};
+
+type Answer = {
+ text: string;
+};
+
+type Quiz = {
+ uid: string;
+ question: Question;
+ answers: Answer[];
+};
+
+/** @type {import('./$types').PageLoad} */
+export async function load() {
+ const res = await fetch("http://localhost:8080/quizzes");
+ const response = await res.json();
+
+ console.log(response);
+ if (response.status === "success") {
+ return { quizzes: (await response.content) as Quiz[] };
+ }
+}
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte
index bc72828..51ea996 100644
--- a/frontend/src/routes/dashboard/+page.svelte
+++ b/frontend/src/routes/dashboard/+page.svelte
@@ -3,27 +3,39 @@
import { get } from "svelte/store";
import identity from "$lib/stores/kratos/identity";
import CodeMirror, { basicSetup } from "$lib/components/codemirror/codemirror.svelte";
-
+ import type { PageData } from './$types';
+
+ export let data: PageData;
+ $: quizzes = data.quizzes;
+
const _identity = get(identity);
let email = "";
- let store;
+ let store: any;
if (_identity && _identity.traits) email = _identity.traits.email;
- function changeHandler({ detail: {tr} }) {
+ function changeHandler({ detail: {tr: any} }) {
console.log('change', tr.changes.toJSON())
}
+
- Dashboard
+ Probo Dashboard
Hello {email}
-
+ {quiz.Question.Text}
+
+ {/each}
+
+
+ on:change={changeHandler}>
+
Settings
Logout
diff --git a/main.go b/main.go
index 31181d8..86ab4af 100644
--- a/main.go
+++ b/main.go
@@ -9,7 +9,7 @@ import (
"github.com/sirupsen/logrus"
)
-const port = "3000"
+const port = "8080"
func main() {
// logger.SetLevel(logger.DebugLevel)
diff --git a/server.go b/server.go
index ff276bc..6010e3f 100644
--- a/server.go
+++ b/server.go
@@ -10,6 +10,7 @@ import (
"git.andreafazzi.eu/andrea/probo/models"
"git.andreafazzi.eu/andrea/probo/store"
"github.com/julienschmidt/httprouter"
+ "log"
)
type ProboCollectorServer struct {
@@ -100,6 +101,7 @@ func (ps *ProboCollectorServer) updateQuizHandler(w http.ResponseWriter, r *http
}
func (ps *ProboCollectorServer) readAllQuiz(w http.ResponseWriter, r *http.Request) ([]*models.Quiz, error) {
+ log.Println(r)
quizzes, err := ps.store.ReadAllQuizzes()
if err != nil {
return nil, err
diff --git a/tests/hurl/create_new_quiz.hurl b/tests/hurl/create_new_quiz.hurl
index 71c50a0..38bf68a 100644
--- a/tests/hurl/create_new_quiz.hurl
+++ b/tests/hurl/create_new_quiz.hurl
@@ -1,4 +1,4 @@
-POST http://localhost:3000/quizzes/create
+POST http://localhost:8080/quizzes/create
{
"question": {"text": "Text of Question 1"},
"answers": [
diff --git a/tests/hurl/read_all_quiz.hurl b/tests/hurl/read_all_quiz.hurl
index 5b36af9..60ba47b 100644
--- a/tests/hurl/read_all_quiz.hurl
+++ b/tests/hurl/read_all_quiz.hurl
@@ -1 +1 @@
-GET http://localhost:3000/quizzes
+GET http://localhost:8080/quizzes