add loading

This commit is contained in:
neko
2022-11-14 13:08:25 +03:00
parent 25ca4cdd3b
commit f3906691e0
2 changed files with 9 additions and 0 deletions

View File

@@ -20,4 +20,8 @@
.rowHeader { .rowHeader {
display: flex; display: flex;
}
.loading {
} }

View File

@@ -36,11 +36,13 @@ const HW15 = () => {
const [sort, setSort] = useState('') const [sort, setSort] = useState('')
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [count, setCount] = useState(4) const [count, setCount] = useState(4)
const [idLoading, setLoading] = useState(false)
const [totalCount, setTotalCount] = useState(100) const [totalCount, setTotalCount] = useState(100)
const [searchParams, setSearchParams] = useSearchParams() const [searchParams, setSearchParams] = useSearchParams()
const [techs, setTechs] = useState<TechType[]>([]) const [techs, setTechs] = useState<TechType[]>([])
const sendQuery = (params: any) => { const sendQuery = (params: any) => {
setLoading(true)
getTechs(params) getTechs(params)
.then((res) => { .then((res) => {
// делает студент // делает студент
@@ -50,6 +52,7 @@ const HW15 = () => {
setTotalCount(res.data.totalCount) setTotalCount(res.data.totalCount)
} }
setLoading(false)
// //
}) })
} }
@@ -109,6 +112,8 @@ const HW15 = () => {
<div className={s2.hwTitle}>Homework #15</div> <div className={s2.hwTitle}>Homework #15</div>
<div className={s2.hw}> <div className={s2.hw}>
{idLoading && <div id={'hw15-loading'} className={s.loading}>Loading...</div>}
<SuperPagination <SuperPagination
page={page} page={page}
itemsCountForPage={count} itemsCountForPage={count}