Merge branch 'develop' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend into develop
This commit is contained in:
commit
2165c7a535
|
@ -1,34 +1,29 @@
|
|||
import React, {useContext} from "react";
|
||||
import React from "react";
|
||||
import {observer} from 'mobx-react-lite';
|
||||
import {useStore} from "../../utils/useStore";
|
||||
import {Button, Card, Col, Form, Input, message, Row, Typography} from 'antd';
|
||||
import {useHistory} from "react-router-dom";
|
||||
import {LINKS} from "../../routes/app";
|
||||
import {ModalLoaderContext} from "../../utils/modal";
|
||||
|
||||
export const Login = observer(() => {
|
||||
const store = useStore();
|
||||
let history = useHistory();
|
||||
const [form] = Form.useForm();
|
||||
const modalLoader = useContext(ModalLoaderContext);
|
||||
|
||||
const handleLogin = async (params) => {
|
||||
try {
|
||||
//modalLoader.setLoading(true);
|
||||
await store.authentication.login({
|
||||
username: params.username,
|
||||
password: params.password,
|
||||
});
|
||||
//modalLoader.setLoading(false);
|
||||
history.push(LINKS.HOME);
|
||||
} catch (e) {
|
||||
modalLoader.setLoading(true);
|
||||
if (e.response?.body?.message) {
|
||||
message.error(e.response.body.message);
|
||||
return;
|
||||
}
|
||||
message.error(e.message);
|
||||
}
|
||||
history.push(LINKS.HOME);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue
Block a user