From ea455e757281f0bd2b8ee389311542acbc6367de Mon Sep 17 00:00:00 2001 From: Lukasz Warda Date: Tue, 12 Sep 2023 12:03:03 +0200 Subject: [PATCH] add task solution --- src/App.tsx | 2 +- src/components/Footer.tsx | 4 +-- src/components/TempTodo.tsx | 61 ++++++++++++++++++------------------- src/hooks.ts | 4 +-- src/types/Errors.ts | 2 +- 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 816d836ec..71feb3240 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -151,7 +151,7 @@ export const App: React.FC = () => { + -
-
-
-
- - ); -}; +
+
+
+
+ +); diff --git a/src/hooks.ts b/src/hooks.ts index cd705c23e..7063081e8 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -5,7 +5,7 @@ import { Errors, Todo } from './types'; export const useGetTodos = (USER_ID: number, makeAnyChange: boolean) => { const [isLoading, setIsLoading] = useState(true); const [todos, setTodos] = useState([]); - const [errorMessage, setErrorMessage] = useState(Errors.noEroor); + const [errorMessage, setErrorMessage] = useState(Errors.noError); useEffect(() => { async function fetchTodos() { @@ -26,7 +26,7 @@ export const useGetTodos = (USER_ID: number, makeAnyChange: boolean) => { useEffect(() => { if (errorMessage) { setTimeout(() => { - setErrorMessage(Errors.noEroor); + setErrorMessage(Errors.noError); }, 3000); } }, [errorMessage]); diff --git a/src/types/Errors.ts b/src/types/Errors.ts index cca323f38..596af2361 100644 --- a/src/types/Errors.ts +++ b/src/types/Errors.ts @@ -1,5 +1,5 @@ export enum Errors { - noEroor = '', + noError = '', emptyTitle = "Title can't be empty", delete = 'Unable to delete a todo', add = 'Unable to add a todo',