fix auth error
This commit is contained in:
parent
00c8831dc9
commit
3980f11f18
@ -24,11 +24,16 @@ 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))
|
||||
|
||||
if (state) {
|
||||
@ -91,6 +96,9 @@ function Login() {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{errorMsg.map(x => (
|
||||
<p>{x.msg}</p>
|
||||
))}
|
||||
<a className={'block'}>Forgout account ?</a>
|
||||
<input type={'submit'} value={'sign in'} className={'p-1 text-sm text-primary mt-4'} style={{ backgroundColor: '#a8adb3', borderRadius: 7 }} />
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user