From 37842177a62966141b65eeb813d41657eb1a39a1 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Wed, 15 Oct 2025 15:05:56 +0200 Subject: [PATCH] fix: improve error handling in login mutation to display error messages --- apps/infoalloggi/src/forms/FormLogin.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/infoalloggi/src/forms/FormLogin.tsx b/apps/infoalloggi/src/forms/FormLogin.tsx index abee7cc..369dccb 100644 --- a/apps/infoalloggi/src/forms/FormLogin.tsx +++ b/apps/infoalloggi/src/forms/FormLogin.tsx @@ -46,8 +46,8 @@ export const FormLogin = () => { const utils = api.useUtils(); const { mutate, isPending } = api.auth.loginUser.useMutation({ - onError: () => { - toast.error(t.auth.login.fail); + onError: ({ message }) => { + toast.error(`${t.auth.login.fail}\n${message}`); }, onSuccess: async () => { await utils.auth.getSession.invalidate();