feat: add support for custom error messages in auth middleware

This commit is contained in:
yanghao05
2025-04-29 16:35:40 +08:00
parent cfdf4fa461
commit d9a40dc636
2 changed files with 11 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ func (f *Middlewares) Auth(ctx fiber.Ctx) error {
return ctx.Redirect().To(fullUrl)
}
user, err = models.Users.GetByID(ctx.Context(), jwt.UserID)
user, err := models.Users.GetByID(ctx.Context(), jwt.UserID)
if err != nil {
// remove cookie
ctx.ClearCookie("token")