Skip to content

Commit

Permalink
fix mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
igor.polianskyi committed Oct 7, 2024
1 parent 1ce43cf commit 38d98ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/components/TodoList/TodoList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useAppSelector } from '../../app/hooks';
import classNames from 'classnames';
import { useDispatch } from 'react-redux';
import { setCurrentTodo } from '../../features/currentTodo';
import { Status } from '../../types/Status';

export const TodoList: React.FC = () => {
const todos = useAppSelector(state => state.todos);
Expand All @@ -13,11 +14,11 @@ export const TodoList: React.FC = () => {

const filteredTodos = todos
.filter(todo => {
if (status === 'completed') {
if (status === Status.Completed) {
return todo.completed;
}

if (status === 'active') {
if (status === Status.Active) {
return !todo.completed;
}

Expand Down
6 changes: 5 additions & 1 deletion src/types/Status.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export type Status = 'all' | 'active' | 'completed';
export enum Status {
All = 'all',
Active = 'active',
Completed = 'completed',
}

0 comments on commit 38d98ad

Please sign in to comment.