Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constructor(props) {
- super(props);
- this.state = { displayData: [] };
- }
- async componentDidMount() {
- await this.props.getRoadmapByUser({
- user_id: this.props.location.pathname.slice(9)
- });
- this.setState({
- displayData: this.props.auth.other_author_created_roadmaps
- });
- }
- async componentDidMount() {
- await this.props.getRoadmapByUser({
- user_id: this.props.location.pathname.slice(9)
- });
- }
- export const getRoadmapByUser = id => dispatch => {
- return axios
- .post("/api/users/getroadmapbyuser", id)
- .then(res => dispatch({ type: GET_ROADMAPS_BY_USER, payload: res.data }));
- };
- router.post("/getroadmapbyuser", (req, res) => {
- User.findOne({ _id: req.body.user_id }).then(user =>
- res.json(user.createdRoadmap)
- );
- });
- case GET_ROADMAPS_BY_USER:
- return {
- ...state,
- other_author_created_roadmaps: action.payload
- };
Add Comment
Please, Sign In to add comment