From a5c07b7c786117545a7e2c531fe9476ec145e11d Mon Sep 17 00:00:00 2001 From: RW Date: Mon, 31 Mar 2025 09:30:03 +0200 Subject: [PATCH] Apply suggestions from code review --- docs/api/state.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api/state.md b/docs/api/state.md index 9d2cc3b7..b22b9675 100644 --- a/docs/api/state.md +++ b/docs/api/state.md @@ -543,8 +543,8 @@ func main() { app.Get("/config", func(c fiber.Ctx) error { config := map[string]any{ "environment": environment, - "apiUrl": fiber.GetStateWithDefault(app.State(), "apiUrl", ""), - "debug": fiber.GetStateWithDefault(app.State(), "debug", false), + "apiUrl": fiber.GetStateWithDefault(c.App().State(), "apiUrl", ""), + "debug": fiber.GetStateWithDefault(c.App().State(), "debug", false), } return c.JSON(config) }) @@ -601,7 +601,7 @@ func main() { } // Save the user to the database. - rdb, ok := fiber.GetState[*redis.Client](app.State(), "redis") + rdb, ok := fiber.GetState[*redis.Client](c.App().State(), "redis") if !ok { return c.Status(fiber.StatusInternalServerError).SendString("Redis client not found") } @@ -619,7 +619,7 @@ func main() { app.Get("/user/:id", func(c fiber.Ctx) error { id := c.Params("id") - rdb, ok := fiber.GetState[*redis.Client](app.State(), "redis") + rdb, ok := fiber.GetState[*redis.Client](c.App().State(), "redis") if !ok { return c.Status(fiber.StatusInternalServerError).SendString("Redis client not found") }