summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard/controller.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-17 14:08:18 -0600
committermo khan <mo@mokhan.ca>2025-04-17 14:08:18 -0600
commit62c24d360745ef8778a322c276a9ad577dfc7713 (patch)
treea93eb5de35fb283bfa014bd3c23094017a2e72c4 /app/controllers/dashboard/controller.go
parent81d3482b6937617ba3fd778a42d2fbbbf0b8e2b7 (diff)
refactor: move context keys to key package
Diffstat (limited to 'app/controllers/dashboard/controller.go')
-rw-r--r--app/controllers/dashboard/controller.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go
index d805027..b27ebe1 100644
--- a/app/controllers/dashboard/controller.go
+++ b/app/controllers/dashboard/controller.go
@@ -4,13 +4,10 @@ import (
"html/template"
"net/http"
- "github.com/xlgmokha/x/pkg/context"
"github.com/xlgmokha/x/pkg/x"
- "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/domain"
+ "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/key"
)
-var CurrentUserKey context.Key[*domain.User] = context.Key[*domain.User]("current_user")
-
type Controller struct {
}
@@ -23,7 +20,7 @@ func (c *Controller) MountTo(mux *http.ServeMux) {
}
func (c *Controller) Show(w http.ResponseWriter, r *http.Request) {
- currentUser := CurrentUserKey.From(r.Context())
+ currentUser := key.CurrentUserKey.From(r.Context())
if x.IsZero(currentUser) {
http.Redirect(w, r, "/", http.StatusFound)