diff --git a/src/App.tsx b/src/App.tsx
index c43e347f8..c227561cc 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,6 +1,5 @@
/* eslint-disable jsx-a11y/control-has-associated-label */
import React, { useEffect } from 'react';
-import { UserWarning } from './UserWarning';
import { getTodos } from './api/todos';
import { Header } from './components/Header';
import { Footer } from './components/Footer';
@@ -57,10 +56,6 @@ export const App: React.FC = () => {
}
});
- if (!USER_ID) {
- return ;
- }
-
return (
todos
diff --git a/src/UserWarning.tsx b/src/UserWarning.tsx
deleted file mode 100644
index fa25838e6..000000000
--- a/src/UserWarning.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-
-export const UserWarning: React.FC = () => (
-
-
- Please get your userId {' '}
-
- here
- {' '}
- and save it in the app
const USER_ID = ...
- All requests to the API must be sent with this
- userId.
-
-
-);
diff --git a/src/api/todos.ts b/src/api/todos.ts
index 2cb0bf6fd..f999be41a 100644
--- a/src/api/todos.ts
+++ b/src/api/todos.ts
@@ -1,10 +1,6 @@
import { Todo } from '../types/Todo';
import { client } from '../utils/fetchClient';
-// Your userId is 1414
-// Please use it for all your requests to the Students API. For example:
-// https://mate.academy/students-api/todos?userId=1414
-
export const getTodos = (userid: number) => {
return client.get
(`/todos?userId=${userid}`);
};
diff --git a/src/components/TodoItem.tsx b/src/components/TodoItem.tsx
index dd22a7a99..96ea5d382 100644
--- a/src/components/TodoItem.tsx
+++ b/src/components/TodoItem.tsx
@@ -81,7 +81,7 @@ export const TodoItem: React.FC = ({ todo }) => {
if (newTitle.trim() === '') {
try {
- await handleDeleteTodo(todo.id);
+ await handleDeleteTodo(id);
} catch (err) {
if (err) {
errorMsg = true;
@@ -89,7 +89,7 @@ export const TodoItem: React.FC = ({ todo }) => {
focusInput(inputRef);
}
- } else if (newTitle.trim() !== todo.title) {
+ } else if (newTitle.trim() !== title) {
try {
await handleUpdateTodo(todo, newTitle.trim());
} catch (err) {
diff --git a/src/index.tsx b/src/index.tsx
index 8caeb506f..827ee1946 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,5 +1,4 @@
import { createRoot } from 'react-dom/client';
-
import 'bulma/css/bulma.css';
import '@fortawesome/fontawesome-free/css/all.css';
import './styles/index.scss';