|
@@ -4,33 +4,28 @@ import {connect} from "react-redux";
|
|
import {useEffect, useState} from "react";
|
|
import {useEffect, useState} from "react";
|
|
import {
|
|
import {
|
|
changeAuthData,
|
|
changeAuthData,
|
|
- changeAuthDataAsync,
|
|
|
|
- setActiveUserData,
|
|
|
|
|
|
+ changeAuthDataAsync, setActiveUserAllPosts,
|
|
|
|
+ setActiveUserData, setOwnerData,
|
|
setUserDataAsync
|
|
setUserDataAsync
|
|
} from "../store/actionCreators/ActionCreators";
|
|
} from "../store/actionCreators/ActionCreators";
|
|
import {useNavigate} from "react-router-dom";
|
|
import {useNavigate} from "react-router-dom";
|
|
import avatar from "../assets/img/avatarGolub.jpg"
|
|
import avatar from "../assets/img/avatarGolub.jpg"
|
|
import ModalWindow from "./ModalWindow";
|
|
import ModalWindow from "./ModalWindow";
|
|
import NewPost from "./NewPost";
|
|
import NewPost from "./NewPost";
|
|
-import {HeaderButtons} from "../shared/styledComponents";
|
|
|
|
|
|
+import {HeaderButtons, Logotip} from "../shared/styledComponents";
|
|
|
|
|
|
|
|
|
|
const HeaderWrapper = styled.div`
|
|
const HeaderWrapper = styled.div`
|
|
- padding: 2px 80px;
|
|
|
|
|
|
+ width: 90%;
|
|
|
|
+ padding: 2px 100px;
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: space-evenly;
|
|
justify-content: space-evenly;
|
|
align-items: center;
|
|
align-items: center;
|
|
box-shadow: 0px 10px 13px -7px #000000, 5px 5px 15px 5px rgba(41, 78, 255, 0);
|
|
box-shadow: 0px 10px 13px -7px #000000, 5px 5px 15px 5px rgba(41, 78, 255, 0);
|
|
`
|
|
`
|
|
-const Logotip = styled.p`
|
|
|
|
-font-size: 30px;
|
|
|
|
- margin: 0;
|
|
|
|
-color:grey;
|
|
|
|
-`
|
|
|
|
|
|
|
|
|
|
|
|
const OwnerHeader = (props) => {
|
|
const OwnerHeader = (props) => {
|
|
-
|
|
|
|
const [isModal, setisModal] = useState(false);
|
|
const [isModal, setisModal] = useState(false);
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
|
|
|
|
@@ -38,15 +33,14 @@ const OwnerHeader = (props) => {
|
|
if (!props.ownerData) {
|
|
if (!props.ownerData) {
|
|
props.setUserDataAsync(props.id, true)
|
|
props.setUserDataAsync(props.id, true)
|
|
}
|
|
}
|
|
-
|
|
|
|
})
|
|
})
|
|
|
|
|
|
const logout = () => {
|
|
const logout = () => {
|
|
localStorage.authToken = "";
|
|
localStorage.authToken = "";
|
|
- props.changeAuthData({
|
|
|
|
- token: "",
|
|
|
|
- user: ""
|
|
|
|
- })
|
|
|
|
|
|
+ props.changeAuthData(null)
|
|
|
|
+ props.setActiveUserData(null)
|
|
|
|
+ props.setOwnerData(null)
|
|
|
|
+ props.setActiveUserAllPosts(null)
|
|
navigate("/auth")
|
|
navigate("/auth")
|
|
|
|
|
|
}
|
|
}
|
|
@@ -68,7 +62,7 @@ const OwnerHeader = (props) => {
|
|
return (
|
|
return (
|
|
<HeaderWrapper>
|
|
<HeaderWrapper>
|
|
|
|
|
|
- <Logotip>=HIPSTARGAM=</Logotip>
|
|
|
|
|
|
+ <Logotip>=HIPSTAGRAM=</Logotip>
|
|
<HeaderButtons onClick={feedHandler}>Feed</HeaderButtons>
|
|
<HeaderButtons onClick={feedHandler}>Feed</HeaderButtons>
|
|
|
|
|
|
<HeaderButtons onClick={toogleModal}>+ post</HeaderButtons>
|
|
<HeaderButtons onClick={toogleModal}>+ post</HeaderButtons>
|
|
@@ -86,7 +80,7 @@ const OwnerHeader = (props) => {
|
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
const mapStateToProps = (state) => {
|
|
return {
|
|
return {
|
|
- id: state.auth.user.sub.id,
|
|
|
|
|
|
+ id: state.auth?.user?.sub?.id,
|
|
ownerData: state.ownerData,
|
|
ownerData: state.ownerData,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -95,7 +89,9 @@ const mapDispatchToProps = (dispatch) => {
|
|
changeAuthData: (authData) => dispatch(changeAuthData(authData)),
|
|
changeAuthData: (authData) => dispatch(changeAuthData(authData)),
|
|
changeAuthDataAsync: (authData) => dispatch(changeAuthDataAsync(authData)),
|
|
changeAuthDataAsync: (authData) => dispatch(changeAuthDataAsync(authData)),
|
|
setUserDataAsync: (id, isOwner) => dispatch(setUserDataAsync(id, isOwner)),
|
|
setUserDataAsync: (id, isOwner) => dispatch(setUserDataAsync(id, isOwner)),
|
|
- setActiveUserData: (user) => dispatch(setActiveUserData(user))
|
|
|
|
|
|
+ setActiveUserData: (user) => dispatch(setActiveUserData(user)),
|
|
|
|
+ setOwnerData : (user) => dispatch(setOwnerData(user)),
|
|
|
|
+ setActiveUserAllPosts: (posts) => dispatch(setActiveUserAllPosts(posts)),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|