Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: filter done quests in trending #473

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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