mirror of
https://github.com/khorevaa/kubodin.git
synced 2024-12-12 08:54:22 +02:00
22 lines
391 B
Go
22 lines
391 B
Go
package api
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
"github.com/khorevaa/kubodin/service"
|
|
)
|
|
|
|
func withClient(fn func(client service.ClientContext, ctx *fiber.Ctx) error) fiber.Handler {
|
|
|
|
return func(ctx *fiber.Ctx) error {
|
|
|
|
client, err := service.GetClientContext(ctx)
|
|
|
|
if err != nil {
|
|
return ErrorResponse(ctx, err, "error get context client")
|
|
}
|
|
|
|
return fn(client, ctx)
|
|
|
|
}
|
|
}
|