Feat: create room
This commit is contained in:
@ -23,8 +23,16 @@ func HandleCreateRoom(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
ctx := context.WithValue(r.Context(), "current_room", room.ID)
|
||||
ctx, err = updateRoomInSession(ctx, room.ID)
|
||||
fi, err := getFullInfoByCtx(ctx)
|
||||
if err != nil {
|
||||
msg := "failed to get full info from ctx"
|
||||
log.Error(msg, "error", err)
|
||||
abortWithError(w, msg)
|
||||
return
|
||||
}
|
||||
fi.State.RoomID = room.ID
|
||||
fi.Room = room
|
||||
if err := saveFullInfo(fi); err != nil {
|
||||
msg := "failed to set current room to session"
|
||||
log.Error(msg, "error", err)
|
||||
abortWithError(w, msg)
|
||||
@ -41,7 +49,7 @@ func HandleCreateRoom(w http.ResponseWriter, r *http.Request) {
|
||||
abortWithError(w, err.Error())
|
||||
return
|
||||
}
|
||||
tmpl.ExecuteTemplate(w, "base", nil)
|
||||
tmpl.ExecuteTemplate(w, "base", fi)
|
||||
}
|
||||
|
||||
func HandleRoomEnter(w http.ResponseWriter, r *http.Request) {
|
||||
|
Reference in New Issue
Block a user