fix: rendering index page after login
This commit is contained in:
@@ -20,7 +20,7 @@ type SessionData struct {
|
||||
|
||||
type SessionManagement interface {
|
||||
Get(sessionId int) SessionData
|
||||
Save(ctx context.Context, roomName string, personId rooms.PersonId) (int, error)
|
||||
Save(ctx context.Context, roomName string, personId rooms.PersonId) (SessionData, error)
|
||||
Remove(ctx context.Context, sessionId int) error
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (redisSM RedisSM) Get(sessionId int) SessionData {
|
||||
log.Printf("> successfully found %d %+v", sessionId, foundSession)
|
||||
return foundSession
|
||||
}
|
||||
func (redisSM RedisSM) Save(ctx context.Context, roomName string, personId rooms.PersonId) (int, error) {
|
||||
func (redisSM RedisSM) Save(ctx context.Context, roomName string, personId rooms.PersonId) (SessionData, error) {
|
||||
randId := rand.Int()
|
||||
newSession := SessionData{
|
||||
SessionId: randId,
|
||||
@@ -57,9 +57,9 @@ func (redisSM RedisSM) Save(ctx context.Context, roomName string, personId rooms
|
||||
|
||||
if err != nil {
|
||||
log.Printf("> error! saving session %+v %s", newSession, err)
|
||||
return 0, fmt.Errorf("error saving new session: %+v with %s", newSession, err)
|
||||
return SessionData{}, fmt.Errorf("error saving new session: %+v with %s", newSession, err)
|
||||
}
|
||||
return randId, nil
|
||||
return newSession, nil
|
||||
}
|
||||
|
||||
func (redisSM RedisSM) Remove(ctx context.Context, sessionId int) error {
|
||||
@@ -73,9 +73,9 @@ func (d DummySM) Get(sessionId int) SessionData {
|
||||
log.Printf("get dummy session by %d", sessionId)
|
||||
return SessionData{}
|
||||
}
|
||||
func (d DummySM) Save(ctx context.Context, roomName string, personId rooms.PersonId) (int, error) {
|
||||
func (d DummySM) Save(ctx context.Context, roomName string, personId rooms.PersonId) (SessionData, error) {
|
||||
log.Printf("save dummy session with %s %d", roomName, personId)
|
||||
return 1, nil
|
||||
return SessionData{}, nil
|
||||
}
|
||||
func (d DummySM) Remove(ctx context.Context, sessionId int) error {
|
||||
log.Printf("deleting session %d", sessionId)
|
||||
|
||||
Reference in New Issue
Block a user