From b6be0d51a597301cb4c1e03934d70d6c08d9c540 Mon Sep 17 00:00:00 2001 From: Nico <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Sun, 21 Jan 2024 10:15:28 +0100 Subject: [PATCH] feat: filter done quests in trending (#473) --- context/QuestsProvider.tsx | 12 +++++++----- services/apiService.ts | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/context/QuestsProvider.tsx b/context/QuestsProvider.tsx index 194b4af3..e1e10867 100644 --- a/context/QuestsProvider.tsx +++ b/context/QuestsProvider.tsx @@ -98,11 +98,13 @@ export const QuestsContextProvider = ({ }, []); useMemo(() => { - getTrendingQuests().then((data: QuestDocument[] | QueryError) => { - if ((data as QueryError).error) return; - setTrendingQuests(data as QuestDocument[]); - }); - }, []); + getTrendingQuests(hexToDecimal(address)).then( + (data: QuestDocument[] | QueryError) => { + if ((data as QueryError).error) return; + setTrendingQuests(data as QuestDocument[]); + } + ); + }, [address]); useMemo(() => { if (!address) return; diff --git a/services/apiService.ts b/services/apiService.ts index 7eb30821..dba45eca 100644 --- a/services/apiService.ts +++ b/services/apiService.ts @@ -120,9 +120,11 @@ export const getQuests = async () => { } }; -export const getTrendingQuests = async () => { +export const getTrendingQuests = async (addr = "") => { try { - const response = await fetch(`${baseurl}/get_trending_quests`); + const response = await fetch( + `${baseurl}/get_trending_quests${addr ? `?addr=${addr}` : ""}` + ); return await response.json(); } catch (err) { console.log("Error while fetching trending quests", err);