From 01886ad6db8a78fbacabff5e3bd5864391e5a48f Mon Sep 17 00:00:00 2001
From: Tobias Prima <88434271+tobiasprima@users.noreply.github.com>
Date: Thu, 21 Mar 2024 21:04:48 +0800
Subject: [PATCH] feat: loading network calls (#15)
---
src/features/todos/TodoList.js | 9 ++++++---
src/index.css | 18 ++++++++++++++++++
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/features/todos/TodoList.js b/src/features/todos/TodoList.js
index 8edc97c..0914dda 100644
--- a/src/features/todos/TodoList.js
+++ b/src/features/todos/TodoList.js
@@ -33,8 +33,8 @@ const TodoList = () => {
const [ addTodo ] = useAddTodoMutation()
const [ doneTodo ] = useDoneTodoMutation()
const [ deleteTodo ] = useDeleteTodoMutation()
- const [ reorderTodo ] = useReorderTodoMutation()
- const [ resetTodo ] = useResetTodoMutation()
+ const [ reorderTodo, { isLoading: reorderTodoLoading } ] = useReorderTodoMutation()
+ const [ resetTodo, { isLoading: resetTodoLoading } ] = useResetTodoMutation()
// Effect to load todos from local storage if there is cache
@@ -133,7 +133,7 @@ const TodoList = () => {
}
let content;
- if (isLoading) {
+ if (isLoading || reorderTodoLoading || resetTodoLoading) {
content =