fix(auth): return JSON for HTMX login failures instead of HTML

This commit is contained in:
2026-02-16 21:08:15 -05:00
parent e25dc106fa
commit fce16b53f7
+2 -2
View File
@@ -332,7 +332,7 @@ func (h *AuthHandler) Login(c echo.Context) error {
}
if c.Request().Header.Get("HX-Request") == "true" {
return c.HTML(http.StatusUnauthorized, `<div class="text-red-500">Invalid credentials</div>`)
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "invalid credentials"})
}
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "invalid credentials"})
}
@@ -348,7 +348,7 @@ func (h *AuthHandler) Login(c echo.Context) error {
}
if c.Request().Header.Get("HX-Request") == "true" {
return c.HTML(http.StatusUnauthorized, `<div class="text-red-500">Invalid credentials</div>`)
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "invalid credentials"})
}
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "invalid credentials"})
}