import React, { useState, useEffect } from "react"; import { Form, Input, Button, Checkbox } from "antd"; import { UserOutlined, LockOutlined } from "@ant-design/icons"; import { useHistory, Link } from "react-router-dom"; ////////////////////////////////// import jwt_decode from "jwt-decode"; // import store from './vuex/store'; import thunk from "redux-thunk"; import { createStore, combineReducers, applyMiddleware } from "redux"; import { connect } from "react-redux"; ///////////////////////////////// import getGQL from "../utils/getGQL"; import "../styles/RegisterForm.css"; import { doLogin } from "../actions/authActions"; // import { BrowserRouter as Router, Route } from 'react-router-dom'; // const history = createHistory() ////////////////////////////////////////////////////////////// // const store = createStore(applyMiddleware(thunk)) //вторым параметром идет миддлварь const LoginForm = ({ store, history, doLogin, isLoggedIn }) => { // const history = useHistory(); const [form] = Form.useForm(); const [login, setLogin] = useState(""); const [password, setPassword] = useState(""); useEffect(() => { isLoggedIn && history.push("/private"); }, [isLoggedIn]); const onFinish = (values) => { console.log("Success:", values); }; const onFinishFailed = (errorInfo) => { console.log("Failed:", errorInfo); }; // let p = getGQL('http://player.asmer.fs.a-level.com.ua/graphql')( // let p = getGQL('/graphql')( // `query Login{ // login(login: "${login}", password: "${password}") // }` // ).then((data) => // console.log(data) // ) // store.dispatch(actionPending()) // p.then(data => store.dispatch(actionResolved(data))) ///////////////////////////////////////////////////////////////////////// function onLogin() { doLogin && doLogin(login, password); console.log(login); } return (