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

22 lines
391 B
Go
Raw Permalink Normal View History

2021-03-04 15:09:08 +02:00
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)
}
}