Skip to content

Commit

Permalink
fixed minoe issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NazarVotkanych committed Sep 27, 2023
1 parent 3b013c9 commit f9ab0d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
20 changes: 15 additions & 5 deletions src/components/TodoApp/TodoApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,23 @@ export const TodoApp: React.FC<Props> = ({
const handleTodoSave = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();

if (todosTitle) {
await onTodoUpdate(todosTitle);
} else {
await onDelete(todo.id);
if (todo.title === todosTitle) {
setIsEditing(false);

return;
}

setIsEditing(false);
try {
if (todosTitle) {
await onTodoUpdate(todosTitle);
} else {
await onDelete(todo.id);
}

setIsEditing(false);
// eslint-disable-next-line no-empty
} catch (error) {
}
};

const handleTodoTitleChange = (
Expand Down
13 changes: 2 additions & 11 deletions src/components/TodoHeader/TodoHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ type Props = {
onSubmit: (todo: Todo) => void,
todo?: Todo | null,
userId: number,
// tempTodo: Todo | null,
isLoading: boolean,
errorMessage: string,
request: boolean;
Expand Down Expand Up @@ -69,16 +68,7 @@ export const TodoHeader: React.FC<Props> = ({

return (
<header className="todoapp__header">
{/* {activeTodosCount > 0 && (
// eslint-disable-next-line jsx-a11y/control-has-associated-label
<button
type="button"
className={classNames('todoapp__toggle-all', {
active: isAllCompleted,
})}
data-cy="ToggleAllButton"
/>
)} */}
{/* {Boolean(todos.lenght) && ( */}
<button
type="button"
aria-label="text"
Expand All @@ -88,6 +78,7 @@ export const TodoHeader: React.FC<Props> = ({
data-cy="ToggleAllButton"
onClick={onToggleAll}
/>
{/* )} */}

<form
onSubmit={handleSubmit}
Expand Down

0 comments on commit f9ab0d5

Please sign in to comment.