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 #1565

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

solution #1565

wants to merge 1 commit into from

Conversation

Fridrif27
Copy link

Copy link

@TargoniyAnatoliy TargoniyAnatoliy 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! Everything works properly.


const USER_ID = 0;
export enum FilterParam {
All = 'All',

Choose a reason for hiding this comment

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

You can remove FilterParam into types folder and use it instead type Filter

export const updateTodo = (todoId: number, todo: Todo) => {
return client.patch(`/todos/${todoId}`, todo);
};
// Add more methods here

Choose a reason for hiding this comment

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

remove extra comments

Copy link

@StasSokolov1 StasSokolov1 left a comment

Choose a reason for hiding this comment

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

Let's improve your solution a bit more!

};

export const updateTodo = (todoId: number, todo: Todo) => {
return client.patch(`/todos/${todoId}`, todo);

Choose a reason for hiding this comment

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

let's move /todos into const and reuse

htmlFor={`${id}`}
className="todo__status-label"
onClick={() =>
handleUpdateTodo(id, title, completed ? false : true)

Choose a reason for hiding this comment

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

Suggested change
handleUpdateTodo(id, title, completed ? false : true)
handleUpdateTodo(id, title, completed)

it can be a bit simplify

id: number,
completed: boolean,
) => {
if (event.key === 'Enter') {

Choose a reason for hiding this comment

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

will be good move Enter into const or enum like Keys as we use this in several places


const handleBlur = (id: number, completed: boolean) => {
setIsEditing(null);
if (newTitle.length === 0) {

Choose a reason for hiding this comment

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

Suggested change
if (newTitle.length === 0) {
if (!!newTitle.length) {

can be a bit simplify

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