From 3980f11f183a9584d35caf0fdf85d4e8b21bb220 Mon Sep 17 00:00:00 2001 From: NCanggoro Date: Wed, 27 Sep 2023 22:34:32 +0700 Subject: [PATCH] fix auth error --- src/pages/Login/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index 25931ba..be01327 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -24,10 +24,15 @@ function Login() { e.preventDefault(); try { const res = await loginService({ username: form.username, password: form.password }) - if (res.error) { + if (res.error.response.status == 400) { setErrorMsg(res.error.response.data.errors) return } + + if(res.error) { + alert(res.error.response.data.message) + return + } dispatch(authAdded(res.data)) @@ -91,6 +96,9 @@ function Login() { + {errorMsg.map(x => ( +

{x.msg}

+ ))} Forgout account ?