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

need help #1485

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

need help #1485

wants to merge 7 commits into from

Conversation

Shevchuchka
Copy link

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

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

  1. show the loader on all todos that we need to update/delete immediately
Screen.Recording.2024-10-21.at.10.52.13.mov
  1. remove all comments

Comment on lines 11 to 12
// update: (todoToUpdate: Todo) => void;
// errorFunction: (message: string) => void;

Choose a reason for hiding this comment

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

remove all comments

className={classNames('todoapp__toggle-all', {
active: checkActiveTodos(),
})}
onClick={() => handleToggleAll()}

Choose a reason for hiding this comment

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

Suggested change
onClick={() => handleToggleAll()}
onClick={handleToggleAll}

src/api/todos.ts Outdated
Comment on lines 10 to 16
export const getActiveTodos = () => {
return getTodos().then(todos => todos.filter(todo => !todo.completed));
};

export const getCompletedTodos = () => {
return getTodos().then(todos => todos.filter(todo => todo.completed));
};

Choose a reason for hiding this comment

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

you don't need to make separate requests for active or completed todos, just filter the todos state in the component

src/api/todos.ts Outdated
};

export const createTodo = ({ userId, title, completed }: Omit<Todo, 'id'>) => {
return client.post<Todo>(`/todos`, { userId, title, completed });

Choose a reason for hiding this comment

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

Suggested change
return client.post<Todo>(`/todos`, { userId, title, completed });
return client.post<Todo>('/todos', { userId, title, completed });

Copy link

@anastasiiavorobiova anastasiiavorobiova left a comment

Choose a reason for hiding this comment

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

Great work!
The app always shows an error after deleting the todo (if the user deletes the title and presses enter)

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

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

fix this case(you should delete the todo in this case, but you try to update it)
https://github.com/user-attachments/assets/892759a6-7a65-4885-b19a-64ccd16e8f44

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

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

good job

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.

3 participants