diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..479880f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/node_modules
+/.idea
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..03d9549
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..aa52679
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/todo-app.iml b/.idea/todo-app.iml
new file mode 100644
index 0000000..9e913dc
--- /dev/null
+++ b/.idea/todo-app.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..de204e1
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1598811212310
+
+
+ 1598811212310
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 687f566..720f534 100644
--- a/README.md
+++ b/README.md
@@ -19,3 +19,8 @@
Далее установить зависимости, запустить сервер и клиент.
+```bash
+npm run update
+npm run start
+```
+
diff --git a/client/src/components/Dialogs/Todo/DeleteTodoDialog.js b/client/src/components/Dialogs/Todo/DeleteTodoDialog.js
index 10937e2..aeec790 100644
--- a/client/src/components/Dialogs/Todo/DeleteTodoDialog.js
+++ b/client/src/components/Dialogs/Todo/DeleteTodoDialog.js
@@ -13,11 +13,6 @@ const DeleteTodoDialog = ({ isOpenDialog, handleCloseDialog, selectedTodo }) =>
const [deleteTodo] = useMutation(DELETE_TODO, {
update(cache, { data: { deleteTodo } }) {
-
- /*
- та же самая проблема, когда у нас нету изначально весь список todos,
- мы не можем обновить кэш и получим invariant Violation !!!
- */
try {
try {
const { todos } = cache.readQuery({ query: GET_TODOS })
diff --git a/client/src/components/Modals/Category/CreateCategoryModal.js b/client/src/components/Modals/Category/CreateCategoryModal.js
index d04549c..059cfcc 100644
--- a/client/src/components/Modals/Category/CreateCategoryModal.js
+++ b/client/src/components/Modals/Category/CreateCategoryModal.js
@@ -29,9 +29,15 @@ const CreateCategoryModal = ({ isModalOpen, handleCloseModal }) => {
try {
e.preventDefault()
const elements = e.target.elements
+
+ if (!elements.title.value.trim()) {
+ window.alert('Проверьте правильность введенных данных!')
+ return
+ }
+
createCategory({
variables: {
- title: elements.title.value
+ title: elements.title.value.trim()
}
})
handleCloseModal()
diff --git a/client/src/components/Modals/Category/UpdateCategoryModal.js b/client/src/components/Modals/Category/UpdateCategoryModal.js
index 1713de7..f2a154b 100644
--- a/client/src/components/Modals/Category/UpdateCategoryModal.js
+++ b/client/src/components/Modals/Category/UpdateCategoryModal.js
@@ -16,6 +16,12 @@ const UpdateCategoryModal = ({ isModalOpen, handleCloseModal, selectedCategory,
try {
e.preventDefault()
const elements = e.target.elements
+
+ if (!elements.title.value.trim()) {
+ window.alert('Проверьте правильность введенных данных!')
+ return
+ }
+
updateCategory({
variables: {
id: selectedCategory.id,
diff --git a/client/src/components/Modals/Todo/CreateTodoModal.js b/client/src/components/Modals/Todo/CreateTodoModal.js
index f65f9d4..b31a34f 100644
--- a/client/src/components/Modals/Todo/CreateTodoModal.js
+++ b/client/src/components/Modals/Todo/CreateTodoModal.js
@@ -29,12 +29,6 @@ const CreateTodoModal = ({ isModalOpen, handleCloseModal }) => {
data: { todos: todos.concat([createTodo]) }
});
- /*
- здесь никак не обновить кэш когда нету загруженных изначально данных,
- поэтому получим invariant Violation !!!
- */
-
- /* запрос на обновление кэша при добавлении todo */
try {
const { category } = cache.readQuery({ query: GET_TODOS_BY_CATEGORY, variables: { id: fieldsData.category } })
cache.writeQuery({
@@ -52,14 +46,20 @@ const CreateTodoModal = ({ isModalOpen, handleCloseModal }) => {
try {
e.preventDefault()
const elements = e.target.elements
- createTodo({
- variables: {
- title: elements.title.value,
- description: elements.description.value,
- categoryId: elements.category.value,
- deadline: elements.deadline.value
- }
- })
+
+ if (!elements.title.value.trim() || !elements.description.value.trim() || !elements.category.value.trim() || !elements.deadline.value.trim()) {
+ window.alert('Проверьте правильность введенных данных!')
+ return
+ }
+
+ createTodo({
+ variables: {
+ title: elements.title.value.trim(),
+ description: elements.description.value.trim(),
+ categoryId: elements.category.value.trim(),
+ deadline: elements.deadline.value.trim()
+ }
+ })
handleCloseModal()
setFieldsData({
title: '',
@@ -96,7 +96,7 @@ const CreateTodoModal = ({ isModalOpen, handleCloseModal }) => {