diff --git a/backend/cmd/main.go b/backend/cmd/main.go index de39ea3..0bedccd 100644 --- a/backend/cmd/main.go +++ b/backend/cmd/main.go @@ -39,8 +39,6 @@ func main() { return } - - // Respond with the ID of the newly inserted respondent c.JSON(http.StatusOK, gin.H{"respondentID": respondentId}) }) diff --git a/backend/db/get_user_questions.go b/backend/db/get_user_questions.go index c150c5e..c81d8c5 100644 --- a/backend/db/get_user_questions.go +++ b/backend/db/get_user_questions.go @@ -52,10 +52,16 @@ func GetUserQuestions(respondendID int) ([5]UserQuestions, error) { "LIMIT 5", respondendID) - stmt, err := db.Prepare(getQuestionsStatement) - if err != nil { - log.Fatalf("Error preparing statement: %v\n", err) - } - defer stmt.Close() + stmt, err := db.Prepare(getQuestionsStatement) + if err != nil { + log.Fatalf("Error preparing statement: %v\n", err) + } + defer stmt.Close() + + var questions [5]FormQuestion + + rows, err := stmt.Query(getQuestionsStatement) + + } \ No newline at end of file diff --git a/frontend/src/routes/form/+page.server.ts b/frontend/src/routes/form/+page.server.ts index e69de29..d90d75a 100644 --- a/frontend/src/routes/form/+page.server.ts +++ b/frontend/src/routes/form/+page.server.ts @@ -0,0 +1,12 @@ +import { error } from '@sveltejs/kit'; + +/** @type {import('./$types').PageServerLoad} */ +export async function load({ params }) { + const post = await getPostFromDatabase(params.slug); + + if (post) { + return post; + } + + error(404, 'Not found'); +} \ No newline at end of file