Replaced remaining parts of app to use Redux.

This commit is contained in:
Patrick Fic
2020-01-31 13:57:27 -08:00
parent 3060c16dd3
commit e2518a95ab
12 changed files with 104 additions and 168 deletions

View File

@@ -1,10 +1,7 @@
import React from "react";
import { useQuery } from "react-apollo";
import { Link } from "react-router-dom";
import { GET_CURRENT_USER } from "../../graphql/local.queries";
import { Icon } from "antd";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import React from "react";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { selectCurrentUser } from "../../redux/user/user.selectors";
@@ -12,28 +9,19 @@ const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser
});
const mapDispatchToProps = dispatch => ({
// signOutStart: () => dispatch(signOutStart())
});
export default connect(
mapStateToProps,
mapDispatchToProps
null
)(function ManageSignInButton({ currentUser }) {
return currentUser.isAuthorized ? (
<div>
{" "}
<Link to="/manage">
<Icon type="build" />
Manage
</Link>
</div>
return currentUser.authorized ? (
<Link to="/manage">
<Icon type="build" />
Manage
</Link>
) : (
<div>
<Link to="/signin">
<Icon type="login" />
Sign In
</Link>
</div>
<Link to="/signin">
<Icon type="login" />
Sign In
</Link>
);
});