fix(StorePage/index.tsx): set validApiKey to true in useEffect to fix missing data bug
fix(StorePage/index.tsx): handle unauthorized response and set validApiKey to false to handle invalid API key error
This commit is contained in:
parent
7cfe5da2f9
commit
e021df94f0
1 changed files with 6 additions and 0 deletions
|
|
@ -61,6 +61,7 @@ export default function StorePage(): JSX.Element {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleGetComponents();
|
handleGetComponents();
|
||||||
|
setValidApiKey(true);
|
||||||
}, [
|
}, [
|
||||||
tabActive,
|
tabActive,
|
||||||
pageOrder,
|
pageOrder,
|
||||||
|
|
@ -97,6 +98,11 @@ export default function StorePage(): JSX.Element {
|
||||||
filterByUser: selectFilter === "createdbyme" && validApiKey ? true : null,
|
filterByUser: selectFilter === "createdbyme" && validApiKey ? true : null,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res?.authorized === false && validApiKey === false) {
|
||||||
|
setValidApiKey(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setSearchData(res?.results ?? []);
|
setSearchData(res?.results ?? []);
|
||||||
setTotalRowsCount(
|
setTotalRowsCount(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue