From 2c478b62b09a6b423a3a82183445e33c756774de Mon Sep 17 00:00:00 2001 From: "guoguo.yu" <guoguo.yu@etu.hesge.ch> Date: Thu, 19 Oct 2023 14:44:24 +0200 Subject: [PATCH] messageGet works properly database wise --- main.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/main.go b/main.go index 9f048ab..852a781 100644 --- a/main.go +++ b/main.go @@ -345,6 +345,27 @@ func successSignin(w http.ResponseWriter, r *http.Request) { return } fmt.Println(messages) + // Render the profile page with the user's messages + tmpl, err := template.ParseFiles("./view/profile.html") + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + err = tmpl.Execute(w, struct { + User models.User + Messages []models.Post + FullName string + Email string + }{ + User: user, + Messages: messages, + FullName: user.FullName, + Email: user.Email, + }) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } } -- GitLab