Merge branch 'task-9-login-implementation' of MyFit/users-myfit into master
This commit is contained in:
@@ -4,9 +4,9 @@ import { toast } from "react-toastify";
|
|||||||
import googleLogo from "../../../assets/images/google-logo.svg";
|
import googleLogo from "../../../assets/images/google-logo.svg";
|
||||||
// import titleShape from "../../../assets/images/shape/title-shape.svg";
|
// import titleShape from "../../../assets/images/shape/title-shape.svg";
|
||||||
import titleShape from "../../../assets/images/shape/login_straight_underline.svg";
|
import titleShape from "../../../assets/images/shape/login_straight_underline.svg";
|
||||||
|
import usersService from "../../../services/UsersService";
|
||||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||||
import AuthLayout from "../AuthLayout";
|
import AuthLayout from "../AuthLayout";
|
||||||
import usersService from "../../../services/UsersService";
|
|
||||||
|
|
||||||
export default function Login() {
|
export default function Login() {
|
||||||
const [checked, setValue] = useState(false);
|
const [checked, setValue] = useState(false);
|
||||||
@@ -31,15 +31,15 @@ export default function Login() {
|
|||||||
};
|
};
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const userApi = new usersService();
|
const userApi = new usersService();
|
||||||
const doLogin = () => {
|
const doLogin = async () => {
|
||||||
if (email !== "" && password !== "") {
|
if (email !== "" && password !== "") {
|
||||||
var postData = {
|
var postData = {
|
||||||
username: email,
|
username: email,
|
||||||
password: password
|
password: password
|
||||||
};
|
};
|
||||||
const loginResult = userApi.logInUser(postData); // just for a test
|
const loginResult = await userApi.logInUser(postData); // just for a test
|
||||||
// if (email === "support@mermsemr.com") {
|
// if (email === "support@mermsemr.com") {
|
||||||
if (loginResult.data.status > 0 ) { // just for a start
|
if (loginResult.data.status > 0) { // just for a start
|
||||||
localStorage.setItem("email", `${email}`);
|
localStorage.setItem("email", `${email}`);
|
||||||
setLoginLoading(true);
|
setLoginLoading(true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user