...
 
Commits (2)
import React from "react";
import { Item, Segment, Container } from "semantic-ui-react";
import { add_auth, backend_url } from "utils";
import UserHeader from "user-header/index";
import { receive_user } from "actions/remote-users";
import { connect } from "react-redux";
class FollowSuggestions extends React.Component {
state = { loaded: false, users: [] }
componentDidMount() {
fetch(`${backend_url()}/api/v1/suggestions`, {
headers: add_auth()
})
.then(resp => resp.json())
.then(resp => {
this.setState({ users: resp, loaded: true })
resp.forEach(user => this.props.receive_user(user));
});
}
render() {
if (!this.state.loaded) return <Segment inverted loading />;
return (
<Segment inverted as={Container}>
<Item.Group>
{ this.state.users.map(user => (
<UserHeader id={user.id} key={user.id} user={user} />
))}
</Item.Group>
</Segment>
);
}
}
const mapDispatchToProps = {
receive_user
};
export default connect(null, mapDispatchToProps)(FollowSuggestions);
......@@ -51,10 +51,6 @@ class NavBar extends React.Component {
}
<OnlyLoggedIn>
<Menu.Item as={NavLink} to="/follow-suggestions">
Follow Suggestions
</Menu.Item>
<Menu.Item as={NavLink} to="/user-search">
Search Users
</Menu.Item>
......
......@@ -12,7 +12,6 @@ const routes = [
{ path: "/notifications", component: () => import("notifications/index") },
{ path: "/user/:id", component: () => import("user-timeline/index") },
{ path: "/follow-requests", component: () => import("follow-requests/index") },
{ path: "/follow-suggestions", component: () => import("follow-suggestions/index") },
{ path: "/user-search", component: () => import("user-search/index") },
{ path: "/settings", component: () => import("user-settings/index") }
];
......