Added error handling to allow ID to be searchable
This commit is contained in:
parent
0dc5cff33e
commit
0cee24dfbe
1 changed files with 12 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ import { SkeletonCardComponent } from "../../components/skeletonCardComponent";
|
|||
import { Button } from "../../components/ui/button";
|
||||
import { Input } from "../../components/ui/input";
|
||||
|
||||
import { Link, useParams } from "react-router-dom";
|
||||
import { Link, useNavigate, useParams } from "react-router-dom";
|
||||
import { TagsSelector } from "../../components/tagsSelectorComponent";
|
||||
import { Badge } from "../../components/ui/badge";
|
||||
import {
|
||||
|
|
@ -65,6 +65,8 @@ export default function StorePage(): JSX.Element {
|
|||
const [searchNow, setSearchNow] = useState("");
|
||||
const [selectFilter, setSelectFilter] = useState("all");
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
if (!loadingApiKey) {
|
||||
if (!hasApiKey) {
|
||||
|
|
@ -149,6 +151,11 @@ export default function StorePage(): JSX.Element {
|
|||
.catch((err) => {
|
||||
if (err.response?.status === 403 || err.response?.status === 401) {
|
||||
setValidApiKey(false);
|
||||
} else if (
|
||||
err.response?.data?.detail ===
|
||||
"Unexpected error: Object of type UUID is not JSON serializable"
|
||||
) {
|
||||
navigate("/store/" + inputText);
|
||||
} else {
|
||||
setSearchData([]);
|
||||
setTotalRowsCount(0);
|
||||
|
|
@ -371,7 +378,10 @@ export default function StorePage(): JSX.Element {
|
|||
data={item}
|
||||
authorized={validApiKey}
|
||||
disabled={loading}
|
||||
playground={item.last_tested_version?.includes("1.0.0")&& !item.is_component}
|
||||
playground={
|
||||
item.last_tested_version?.includes("1.0.0") &&
|
||||
!item.is_component
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue