From f3906691e036bad7f92896c3f7913391065dfb5e Mon Sep 17 00:00:00 2001 From: neko Date: Mon, 14 Nov 2022 13:08:25 +0300 Subject: [PATCH] add loading --- src/s2-homeworks/hw15/HW15.module.css | 4 ++++ src/s2-homeworks/hw15/HW15.tsx | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/s2-homeworks/hw15/HW15.module.css b/src/s2-homeworks/hw15/HW15.module.css index 8a0ae1f..8325322 100644 --- a/src/s2-homeworks/hw15/HW15.module.css +++ b/src/s2-homeworks/hw15/HW15.module.css @@ -20,4 +20,8 @@ .rowHeader { display: flex; +} + +.loading { + } \ No newline at end of file diff --git a/src/s2-homeworks/hw15/HW15.tsx b/src/s2-homeworks/hw15/HW15.tsx index 2a556f4..33e3cf7 100644 --- a/src/s2-homeworks/hw15/HW15.tsx +++ b/src/s2-homeworks/hw15/HW15.tsx @@ -36,11 +36,13 @@ const HW15 = () => { const [sort, setSort] = useState('') const [page, setPage] = useState(1) const [count, setCount] = useState(4) + const [idLoading, setLoading] = useState(false) const [totalCount, setTotalCount] = useState(100) const [searchParams, setSearchParams] = useSearchParams() const [techs, setTechs] = useState([]) const sendQuery = (params: any) => { + setLoading(true) getTechs(params) .then((res) => { // делает студент @@ -50,6 +52,7 @@ const HW15 = () => { setTotalCount(res.data.totalCount) } + setLoading(false) // }) } @@ -109,6 +112,8 @@ const HW15 = () => {
Homework #15
+ {idLoading &&
Loading...
} +