-
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 #1587
base: master
Are you sure you want to change the base?
solution #1587
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!)
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.
Almost done, let's improve your solution a bit more!
src/App.tsx
Outdated
try { | ||
setLoadTodo({ | ||
id: 0, | ||
title: todoQuery.trim(), |
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 todoQuery.trim()
into const and reuse
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.
still not fixed
src/api/todos.ts
Outdated
}; | ||
|
||
export const addTodo = (todo: Omit<Todo, 'id' | 'userId' | 'completed'>) => { | ||
return client.post<Todo>(`/todos`, { |
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.
move /todos
into const and reuse
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.
still not fixed
src/components/TodoComponent.tsx
Outdated
try { | ||
setIsToLoad(true); | ||
|
||
if (todoTitle.trim() === '') { |
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.
todoTitle.trim()
move to variable and reuse
src/components/TodoComponent.tsx
Outdated
onClick={async () => { | ||
try { | ||
setIsToLoad(true); | ||
await onRemoveTodo(todo.id); | ||
} catch (err) { | ||
} finally { | ||
setIsToLoad(false); | ||
} | ||
}} |
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.
move into function looks very complicated
src/components/TodoComponent.tsx
Outdated
onSubmit={async e => { | ||
e.preventDefault(); | ||
await saveChangesHandler(); | ||
}} |
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 this also move into function
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.
Still not fixed some comments
src/App.tsx
Outdated
try { | ||
setLoadTodo({ | ||
id: 0, | ||
title: todoQuery.trim(), |
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.
still not fixed
src/api/todos.ts
Outdated
}; | ||
|
||
export const addTodo = (todo: Omit<Todo, 'id' | 'userId' | 'completed'>) => { | ||
return client.post<Todo>(`/todos`, { |
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.
still not fixed
src/components/TodoHeader.tsx
Outdated
searchInput.current?.focus(); | ||
}; | ||
|
||
const ToggleAllHandler = async () => { |
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.
const ToggleAllHandler = async () => { | |
const toggleAllHandler = async () => { |
src/components/TodoHeader.tsx
Outdated
try { | ||
await updateCompletedAllToDo(); | ||
} catch (err) {} |
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.
why we need try {} catch () {} with empty catch block?
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.
Looks good to me, the comments are resolved!
DEMO LINK