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