Added condition to filter by user and likes when unauthorized
This commit is contained in:
parent
750a24521a
commit
219d8803b8
1 changed files with 5 additions and 3 deletions
|
|
@ -23,7 +23,7 @@ import { storeComponent } from "../../types/store";
|
||||||
import { cn } from "../../utils/utils";
|
import { cn } from "../../utils/utils";
|
||||||
import { MarketCardComponent } from "./components/market-card";
|
import { MarketCardComponent } from "./components/market-card";
|
||||||
export default function StorePage(): JSX.Element {
|
export default function StorePage(): JSX.Element {
|
||||||
const { errorApiKey, hasApiKey } = useContext(StoreContext);
|
const { errorApiKey, hasApiKey, setHasApiKey } = useContext(StoreContext);
|
||||||
const { setErrorData } = useContext(alertContext);
|
const { setErrorData } = useContext(alertContext);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [loadingTags, setLoadingTags] = useState(true);
|
const [loadingTags, setLoadingTags] = useState(true);
|
||||||
|
|
@ -52,6 +52,7 @@ export default function StorePage(): JSX.Element {
|
||||||
pageSize,
|
pageSize,
|
||||||
filteredCategories,
|
filteredCategories,
|
||||||
selectFilter,
|
selectFilter,
|
||||||
|
hasApiKey,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function handleGetTags() {
|
function handleGetTags() {
|
||||||
|
|
@ -70,12 +71,13 @@ export default function StorePage(): JSX.Element {
|
||||||
tabActive === "All" ? null : tabActive === "Flows" ? false : true,
|
tabActive === "All" ? null : tabActive === "Flows" ? false : true,
|
||||||
pageOrder === "Popular" ? "-count(downloads)" : "name",
|
pageOrder === "Popular" ? "-count(downloads)" : "name",
|
||||||
filteredCategories,
|
filteredCategories,
|
||||||
selectFilter === "likedbyme" ? true : null,
|
selectFilter === "likedbyme" && hasApiKey ? true : null,
|
||||||
null,
|
null,
|
||||||
searchText === "" ? null : searchText,
|
searchText === "" ? null : searchText,
|
||||||
selectFilter === "createdbyme" ? true : null
|
selectFilter === "createdbyme" && hasApiKey ? true : null
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
setHasApiKey(res?.authorized ?? false);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setSearchData(res?.results ?? []);
|
setSearchData(res?.results ?? []);
|
||||||
setTotalRowsCount(
|
setTotalRowsCount(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue