feat(StorePage): update search data when fetching store components to ensure accurate search results
fix(StorePage): set search data to an empty array when an error occurs to prevent displaying incorrect search results
This commit is contained in:
parent
90853dda96
commit
64b1945cbc
1 changed files with 2 additions and 1 deletions
|
|
@ -55,12 +55,13 @@ export default function StorePage(): JSX.Element {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
getStoreComponents(1, 10)
|
getStoreComponents(1, 10)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
setSearchData(res);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setErrorApiKey(false);
|
setErrorApiKey(false);
|
||||||
setData(res);
|
setData(res);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
setSearchData([]);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setErrorApiKey(true);
|
setErrorApiKey(true);
|
||||||
setErrorData({
|
setErrorData({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue