1
0
mirror of https://github.com/khorevaa/kubodin.git synced 2024-12-12 08:54:22 +02:00
kubodin/api/helpers.go
2021-03-04 16:09:08 +03:00

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)
}
}