fix: improve error handling in login mutation to display error messages
This commit is contained in:
parent
8b2de9472e
commit
37842177a6
1 changed files with 2 additions and 2 deletions
|
|
@ -46,8 +46,8 @@ export const FormLogin = () => {
|
||||||
const utils = api.useUtils();
|
const utils = api.useUtils();
|
||||||
|
|
||||||
const { mutate, isPending } = api.auth.loginUser.useMutation({
|
const { mutate, isPending } = api.auth.loginUser.useMutation({
|
||||||
onError: () => {
|
onError: ({ message }) => {
|
||||||
toast.error(t.auth.login.fail);
|
toast.error(`${t.auth.login.fail}\n${message}`);
|
||||||
},
|
},
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
await utils.auth.getSession.invalidate();
|
await utils.auth.getSession.invalidate();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue