mirror of
https://github.com/Dvorinka/excalidraw-full.git
synced 2026-06-03 13:52:56 +00:00
18 lines
466 B
Go
18 lines
466 B
Go
package workspace
|
|
|
|
import "context"
|
|
|
|
type currentSession struct {
|
|
user *User
|
|
session *Session
|
|
}
|
|
|
|
func withUser(ctx context.Context, user *User, session *Session) context.Context {
|
|
return context.WithValue(ctx, currentUserKey, currentSession{user: user, session: session})
|
|
}
|
|
|
|
func currentUser(r interface{ Context() context.Context }) (*User, *Session) {
|
|
current, _ := r.Context().Value(currentUserKey).(currentSession)
|
|
return current.user, current.session
|
|
}
|