Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #832

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jakubMikolajczykTech
Copy link

Copy link

@choeqq choeqq left a comment

Choose a reason for hiding this comment

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

Almost there, few changes needed ✅

src/App.tsx Outdated
Comment on lines 131 to 132
client
.patch(`/todos/${todoId}`, { completed: !todoToToggle.completed })
Copy link

Choose a reason for hiding this comment

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

make sure to add it to api methods

src/App.tsx Outdated
const allTodosAreCompleted = todos.length === completedTodos.length;

const promiseArray = (allTodosAreCompleted ? completedTodos : activeTodos)
.map((todo: { id: number; completed: boolean; }) => client.patch(`/todos/${todo.id}`, { completed: !todo.completed }));
Copy link

Choose a reason for hiding this comment

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

this should also be a api method

src/App.tsx Outdated
Comment on lines 159 to 160
return client
.patch<Todo>(`/todos/${todoId}`, data)
Copy link

Choose a reason for hiding this comment

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

api method

src/api/todos.ts Outdated
Copy link

Choose a reason for hiding this comment

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

all API methods should go here

Comment on lines +23 to +24
}) => {
return (
Copy link

Choose a reason for hiding this comment

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

Suggested change
}) => {
return (
}) => (

Comment on lines +51 to +52
client
.patch(`/todos/${todo.id}`, { title: newTodoTitle })
Copy link

Choose a reason for hiding this comment

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

api method

Comment on lines +9 to +10
export const TodoStatus: React.FC<Props> = ({ status, onStatusChange }) => {
return (
Copy link

Choose a reason for hiding this comment

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

Suggested change
export const TodoStatus: React.FC<Props> = ({ status, onStatusChange }) => {
return (
export const TodoStatus: React.FC<Props> = ({ status, onStatusChange }) => (

Copy link

@choeqq choeqq left a comment

Choose a reason for hiding this comment

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

LGTM ✅

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