-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: master
Are you sure you want to change the base?
solution #1565
Conversation
There was a problem hiding this 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', |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra comments
There was a problem hiding this 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); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleUpdateTodo(id, title, completed ? false : true) | |
handleUpdateTodo(id, title, completed) |
it can be a bit simplify
id: number, | ||
completed: boolean, | ||
) => { | ||
if (event.key === 'Enter') { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (newTitle.length === 0) { | |
if (!!newTitle.length) { |
can be a bit simplify
DEMO LINK