Skip to content

Commit

Permalink
feat: filter done quests in trending (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchand-Nicolas authored Jan 21, 2024
1 parent 920b3d1 commit b6be0d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions context/QuestsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions services/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

1 comment on commit b6be0d5

@vercel
Copy link

@vercel vercel bot commented on b6be0d5 Jan 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.