Skip to content

Akperov Aleksandr_lesson_7#68

Open
ampersky86 wants to merge 20 commits intoLeonEsquire:masterfrom
ampersky86:hw_7
Open

Akperov Aleksandr_lesson_7#68
ampersky86 wants to merge 20 commits intoLeonEsquire:masterfrom
ampersky86:hw_7

Conversation

@ampersky86
Copy link
Copy Markdown
Contributor

No description provided.

@ampersky86
Copy link
Copy Markdown
Contributor Author

Доделываю

@LeonEsquire
Copy link
Copy Markdown
Owner

Ждемс:) Напишите в личку (на GB), когда доделаете

Comment thread AleksandrAkperov/hw_7/src/index.js Outdated
<Route path= "*" component = {PageNotFound} />

</Route>
</Router>, app)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше обвести весь роутер одним провайдером:)

ReactDOM.render(
  <Provider store={store}>
    <Router history={browserHistory}>
        <Route path = "/" component = {Layout}>
          
          <Route path= "/posts" component = {Posts} />
          <Route path= "/comments" component = {Comments} />
          <Route path= "/users" component = {Users} /> 
          <Route path= "*" component = {PageNotFound} />

        </Route>   
    </Router>
  </Provider>
    , app)

case "DELETE_POST": {
return {...state, posts:action.payload}

}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case "DELETE_POST": {
            const updatedPosts = state.posts.filter((element) => {
                return element.id !== action.payload;
            });
            return {...state, posts: updatedPosts}
        }

return <button className="btn btn-primary" onClick={this.fetchPosts.bind(this)} >Загрузить все посты</button>
}
const postList = posts.map((post, index) => {
return <Post key={index} {...post} deletepost = {this.delete.bind(this, index)} />
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return <Post key={index} {...post} deletepost = {this.delete.bind(this, index)} />
return <Post key={post.id} {...post} deletepost = {this.delete.bind(this, post.id)} />

posts.splice(arguments[0],1);
dispatch({type:"DELETE_POST", payload:posts})
};
} No newline at end of file
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function deletePost(posts) {
    return {type:"DELETE_POST", payload:posts}
};

заменить на это:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants