import {Footer, Links} from "./index"
import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from 'react-router-dom';
import {Provider, connect} from 'react-redux';
import React, {Component, useState, useEffect} from 'react';
// import createHistory from "history/createBrowserHistory";
import {actionAuthLogout, actionUserFindOne} from "../reducers"
import {createStore, combineReducers, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
const StandartMenu = ({className = "standartMenu", getCat = null}) => {
return (
<>
>
)
}
const TabletMenu = ({}) => {
const [show, setShow] = useState(false)
const divStyle = "mobileMenu"
function onClick() {
setShow(!show)
}
return (
<>
{show && }
>
)
}
const ToLoginPage = ({login, onLogout, getData, NickName = "User", loginId}) => {
// useEffect(() => login && getData(loginId),[login])
const history = useHistory();
useEffect(() => history.location.pathname.includes(`/profile/`) && (login ? history.push(`/profile/`) : history.push(`/login`)),[login])
return(
<>
{login ? login : "Вхід"}
{login && }
>
)
}
const CToLoginPage = connect(s => ({
login: s.auth.payload && s.auth.payload.sub.login,
loginId: s.auth.payload && s.auth.payload.sub._id,
NickName: s.promiseRed && s.promiseRed.user &&
s.promiseRed.user.payload && s.promiseRed.user.payload.data &&
s.promiseRed.user.payload.data.UserFindOne &&
s.promiseRed.user.payload.data.UserFindOne.login,
}), {onLogout: actionAuthLogout,
getData: actionUserFindOne,
}) (ToLoginPage);
const Wishes = ({wishesCount}) => {
return(
)
}
const CWishes = connect(s => ({wishesCount: s.wishListReducer.count}), {})(Wishes)
const Basket = ({basketCount, className = "basket"}) => {
return(
)
}
const CBasket = connect(s => ({data: s.basket, basketCount: s.basket.price}), {})(Basket)
const Header = ({}) => {
// const [wishes, wishesCount] = useState(0);
console.log(connect((s) => ({isLoggedIn: s.auth.payload})))
return(
<>
>
)
}
export default Header;