fix: rendering index page after login
This commit is contained in:
@@ -143,26 +143,21 @@ func createRoomHandler(templateFs *embed.FS,
|
||||
log.Printf("what am i to do? error saving room %s", err)
|
||||
// todo return error notice somehow
|
||||
}
|
||||
newSessionId, err := sessionSM.Save(r.Context(), newRoom.Name, person.Id)
|
||||
newSession, err := sessionSM.Save(r.Context(), newRoom.Name, person.Id)
|
||||
if err != nil {
|
||||
log.Printf("what am i to do? error saving session %s", err)
|
||||
// todo return error notice somehow
|
||||
}
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: authCookieName,
|
||||
Value: fmt.Sprint(newSessionId),
|
||||
Value: fmt.Sprint(newSession.SessionId),
|
||||
Secure: true,
|
||||
HttpOnly: true,
|
||||
Path: "/",
|
||||
})
|
||||
var templFile = "templates/index.gohtml"
|
||||
tmpl := template.Must(template.ParseFS(templateFs, templFile))
|
||||
w.Header().Add("HX-Retarget", "body")
|
||||
w.Header().Add("HX-Push-Url", "/")
|
||||
err = tmpl.Execute(w, nil)
|
||||
if err != nil {
|
||||
log.Printf("my error in executing template, huh\n %s", err)
|
||||
}
|
||||
renderIndexPage(newSession, w)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user