Changed response structure(savedFlows not working)
This commit is contained in:
parent
e81e1c808d
commit
7811999c24
1 changed files with 7 additions and 12 deletions
|
|
@ -20,7 +20,6 @@ import { alertContext } from "../../contexts/alertContext";
|
||||||
import { StoreContext } from "../../contexts/storeContext";
|
import { StoreContext } from "../../contexts/storeContext";
|
||||||
import { TabsContext } from "../../contexts/tabsContext";
|
import { TabsContext } from "../../contexts/tabsContext";
|
||||||
import {
|
import {
|
||||||
getCountComponents,
|
|
||||||
getStoreComponents,
|
getStoreComponents,
|
||||||
getStoreSavedComponents,
|
getStoreSavedComponents,
|
||||||
getStoreTags,
|
getStoreTags,
|
||||||
|
|
@ -44,7 +43,7 @@ export default function StorePage(): JSX.Element {
|
||||||
const [size, setPageSize] = useState(10);
|
const [size, setPageSize] = useState(10);
|
||||||
const [index, setPageIndex] = useState(1);
|
const [index, setPageIndex] = useState(1);
|
||||||
const [errorApiKey, setErrorApiKey] = useState(false);
|
const [errorApiKey, setErrorApiKey] = useState(false);
|
||||||
const { setSavedFlows, savedFlows, hasApiKey } = useContext(StoreContext);
|
const { setSavedFlows, hasApiKey } = useContext(StoreContext);
|
||||||
const [tags, setTags] = useState<{ id: string; name: string }[]>([]);
|
const [tags, setTags] = useState<{ id: string; name: string }[]>([]);
|
||||||
const tagListId = useRef<{ id: string; name: string }[]>([]);
|
const tagListId = useRef<{ id: string; name: string }[]>([]);
|
||||||
const [renderPagination, setRenderPagination] = useState(false);
|
const [renderPagination, setRenderPagination] = useState(false);
|
||||||
|
|
@ -75,16 +74,10 @@ export default function StorePage(): JSX.Element {
|
||||||
let results = data?.results ?? [];
|
let results = data?.results ?? [];
|
||||||
results.forEach((flow) => {
|
results.forEach((flow) => {
|
||||||
savedIds.add(flow.id);
|
savedIds.add(flow.id);
|
||||||
});
|
}); /*
|
||||||
setSavedFlows(savedIds);
|
setSavedFlows(savedIds); */
|
||||||
setErrorApiKey(false);
|
setErrorApiKey(false);
|
||||||
}
|
setLoading(false);
|
||||||
|
|
||||||
async function getNumberSavedComponents() {
|
|
||||||
getCountComponents(filterComponent.current).then((res) => {
|
|
||||||
setTotalRowsCount(Number(res["count"]));
|
|
||||||
setLoading(false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleGetComponents = () => {
|
const handleGetComponents = () => {
|
||||||
|
|
@ -93,8 +86,10 @@ export default function StorePage(): JSX.Element {
|
||||||
|
|
||||||
getStoreComponents(index - 1, size, filterComponent.current)
|
getStoreComponents(index - 1, size, filterComponent.current)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
setLoading(false);
|
||||||
setSearchData(res.results);
|
setSearchData(res.results);
|
||||||
getNumberSavedComponents();
|
setTotalRowsCount(Number(res.count));
|
||||||
setErrorApiKey(true);
|
setErrorApiKey(true);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue