feat: go to room on create/login
This commit is contained in:
parent
cdd31e186a
commit
8bb1509786
|
@ -155,9 +155,7 @@ func createRoomHandler(templateFs *embed.FS,
|
|||
HttpOnly: true,
|
||||
Path: "/",
|
||||
})
|
||||
w.Header().Add("HX-Retarget", "body")
|
||||
w.Header().Add("HX-Push-Url", "/")
|
||||
renderIndexPage(newSession, w)
|
||||
w.Header().Add("HX-Redirect", fmt.Sprintf("/room/%s", newRoom.Name))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,23 +273,23 @@ func joinRoomHandler(templateFs *embed.FS,
|
|||
return // error sitting a new person
|
||||
}
|
||||
|
||||
newSessionId, err := sessionSM.Save(r.Context(), room.Name, person.Id)
|
||||
newSession, err := sessionSM.Save(r.Context(), room.Name, person.Id)
|
||||
if err != nil {
|
||||
log.Printf("/login/submit > error saving session %s", err)
|
||||
}
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: authCookieName,
|
||||
Value: fmt.Sprint(newSessionId),
|
||||
Value: fmt.Sprint(newSession.SessionId),
|
||||
Secure: true,
|
||||
HttpOnly: true,
|
||||
Path: "/",
|
||||
})
|
||||
log.Printf("is is %d. room things %s & %s, personal things %s and %s. \n found room %+v",
|
||||
newSessionId, roomName, roomPass, personName, personPass, room,
|
||||
log.Printf("is is %+v. room things %s & %s, personal things %s and %s. \n found room %+v",
|
||||
newSession, roomName, roomPass, personName, personPass, room,
|
||||
)
|
||||
// TODO render what? index page with some data passed?
|
||||
// or, what? i could just redirect to / for now
|
||||
w.Header().Add("HX-Redirect", "/")
|
||||
w.Header().Add("HX-Redirect", fmt.Sprintf("/room/%s", newSession.RoomId))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue