diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-17 14:20:52 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-17 14:20:52 -0600 |
| commit | e3eeba19f090f38712b4720e2f928d503f0d92d2 (patch) | |
| tree | 6418cc22ca11de18265b7d8eeb0fff907460fff6 /app/controllers/dashboard | |
| parent | 62c24d360745ef8778a322c276a9ad577dfc7713 (diff) | |
refactor: remove Key suffix from context keys
Diffstat (limited to 'app/controllers/dashboard')
| -rw-r--r-- | app/controllers/dashboard/controller.go | 2 | ||||
| -rw-r--r-- | app/controllers/dashboard/controller_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go index b27ebe1..184a8ed 100644 --- a/app/controllers/dashboard/controller.go +++ b/app/controllers/dashboard/controller.go @@ -20,7 +20,7 @@ func (c *Controller) MountTo(mux *http.ServeMux) { } func (c *Controller) Show(w http.ResponseWriter, r *http.Request) { - currentUser := key.CurrentUserKey.From(r.Context()) + currentUser := key.CurrentUser.From(r.Context()) if x.IsZero(currentUser) { http.Redirect(w, r, "/", http.StatusFound) diff --git a/app/controllers/dashboard/controller_test.go b/app/controllers/dashboard/controller_test.go index b8199c4..01e3ff6 100644 --- a/app/controllers/dashboard/controller_test.go +++ b/app/controllers/dashboard/controller_test.go @@ -30,7 +30,7 @@ func TestController(t *testing.T) { t.Run("when authenticated", func(t *testing.T) { t.Run("renders a dashboard page", func(t *testing.T) { - ctx := key.CurrentUserKey.With(t.Context(), &domain.User{}) + ctx := key.CurrentUser.With(t.Context(), &domain.User{}) r, w := test.RequestResponse("GET", "/dashboard", test.WithContext(ctx)) mux.ServeHTTP(w, r) |
