add loading

This commit is contained in:
neko
2022-11-08 16:41:30 +03:00
parent ab6238a534
commit e7a5d13774

View File

@@ -15,7 +15,7 @@ import {useSearchParams} from 'react-router-dom'
const getTechs = (find: string) => { const getTechs = (find: string) => {
return axios return axios
.get<{techs: string[]}>( .get<{ techs: string[] }>(
'https://incubator-personal-page-back.herokuapp.com/api/3.0/homework/test2', 'https://incubator-personal-page-back.herokuapp.com/api/3.0/homework/test2',
{params: {find}} {params: {find}}
) )
@@ -49,9 +49,9 @@ const HW14 = () => {
setFind(value) setFind(value)
// делает студент // делает студент
const findQuery: {find?: string} = value ? {find: value} : {} // если нет - то не записывать в урл const findQuery: { find?: string } = value ? {find: value} : {} // если нет - то не записывать в урл
const {find, ...lastQueries} = Object.fromEntries(searchParams) const {find, ...lastQueries} = Object.fromEntries(searchParams)
setSearchParams({...lastQueries, ...findQuery}) setSearchParams({...lastQueries, ...findQuery})
// //
@@ -80,9 +80,14 @@ const HW14 = () => {
onChangeText={onChangeText} onChangeText={onChangeText}
onDebouncedChange={sendQuery} onDebouncedChange={sendQuery}
/> />
<span id={'hw14-loading'}> {isLoading ? (
{isLoading && '...ищем'} <span id={'hw14-loading'}>
</span> ...ищем
</span>
) : (
<br/>
)}
{mappedTechs} {mappedTechs}
</div> </div>
</div> </div>