123456789101112131415161718192021222324 |
- import { connect } from "react-redux"
- import { actionAuthLogout } from "../actions"
- const Profile = ({ user, onLogout }) => {
- return (
- <>
- {user && <div>
- {user.avatar ?
- <img src={user.avatar.url} alt="ava" />
- :
- <img src="https://img.icons8.com/external-bearicons-glyph-bearicons/64/000000/external-User-essential-collection-bearicons-glyph-bearicons.png"
- alt="ava" />}
- <span>{user.nick || user.login}</span>
- <a href="/profile">Редактировать профиль</a>
- <button onClick={() => onLogout()}>Выйти</button>
- </div>}
- </>
- )
- }
- export const ConnectProfile = connect(state => ({ user: state.promise.userInfo?.payload?.data?.UserFindOne }),
- {
- onLogout: actionAuthLogout
- })(Profile)
|