mirror of
https://github.com/makayabou/asg-server.git
synced 2026-05-02 17:43:36 +02:00
19 lines
462 B
Go
19 lines
462 B
Go
package auth
|
|
|
|
import (
|
|
"github.com/capcom6/sms-gateway/internal/sms-gateway/models"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func WithUser(handler func(models.User, *fiber.Ctx) error) fiber.Handler {
|
|
return func(c *fiber.Ctx) error {
|
|
return handler(c.Locals("user").(models.User), c)
|
|
}
|
|
}
|
|
|
|
func WithDevice(handler func(models.Device, *fiber.Ctx) error) fiber.Handler {
|
|
return func(c *fiber.Ctx) error {
|
|
return handler(c.Locals("device").(models.Device), c)
|
|
}
|
|
}
|