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 { Button } from "../../components/ui/button";
|
||||||
import { Input } from "../../components/ui/input";
|
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 { TagsSelector } from "../../components/tagsSelectorComponent";
|
||||||
import { Badge } from "../../components/ui/badge";
|
import { Badge } from "../../components/ui/badge";
|
||||||
import {
|
import {
|
||||||
|
|
@ -65,6 +65,8 @@ export default function StorePage(): JSX.Element {
|
||||||
const [searchNow, setSearchNow] = useState("");
|
const [searchNow, setSearchNow] = useState("");
|
||||||
const [selectFilter, setSelectFilter] = useState("all");
|
const [selectFilter, setSelectFilter] = useState("all");
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loadingApiKey) {
|
if (!loadingApiKey) {
|
||||||
if (!hasApiKey) {
|
if (!hasApiKey) {
|
||||||
|
|
@ -149,6 +151,11 @@ export default function StorePage(): JSX.Element {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.response?.status === 403 || err.response?.status === 401) {
|
if (err.response?.status === 403 || err.response?.status === 401) {
|
||||||
setValidApiKey(false);
|
setValidApiKey(false);
|
||||||
|
} else if (
|
||||||
|
err.response?.data?.detail ===
|
||||||
|
"Unexpected error: Object of type UUID is not JSON serializable"
|
||||||
|
) {
|
||||||
|
navigate("/store/" + inputText);
|
||||||
} else {
|
} else {
|
||||||
setSearchData([]);
|
setSearchData([]);
|
||||||
setTotalRowsCount(0);
|
setTotalRowsCount(0);
|
||||||
|
|
@ -371,7 +378,10 @@ export default function StorePage(): JSX.Element {
|
||||||
data={item}
|
data={item}
|
||||||
authorized={validApiKey}
|
authorized={validApiKey}
|
||||||
disabled={loading}
|
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