fix: updated handlers to use new DecodeJSON generic function

This commit is contained in:
2026-08-14 16:58:52 +02:00
parent e0ab3bb51a
commit 93fd79560c
6 changed files with 20 additions and 69 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ func NewAuthHandler(authService *domain.AuthService) *AuthHandler {
func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
payload, err := request.DecodeLogin(r)
payload, err := request.DecodeJSON[request.LoginPayload](r)
if err != nil {
slog.ErrorContext(ctx, "failed to decode login payload", slog.Any("error", err))
response.Error(ctx, w, http.StatusBadRequest, "failed to decode request body")
@@ -64,7 +64,7 @@ func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request) {
func (h *AuthHandler) Refresh(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
payload, err := request.DecodeRefresh(r)
payload, err := request.DecodeJSON[request.RefreshPayload](r)
if err != nil {
slog.ErrorContext(ctx, "failed to decode refresh payload", slog.Any("error", err))
response.Error(ctx, w, http.StatusBadRequest, "failed to decode request body")