Skip to content
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
10 changes: 10 additions & 0 deletions src/services/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,16 @@ class ChallengesService {
};
}

/**
* Gets user resources.
* @param {String} userId User id whose challenges we want to fetch.
* @return {Promise} Resolves to the api response.
*/
async getUserResources(userId) {
const res = await this.private.apiV5.get(`/resources/${userId}/challenges`);
return res.json();
}

/**
* Gets marathon matches of the specified user.
* @param {String} memberId User whose challenges we want to fetch.
Expand Down
4 changes: 2 additions & 2 deletions src/utils/challenge/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ function filterByUpcoming(challenge, state) {
}

function filterByUsers(challenge, state) {
if (!state.users) return true;
return state.users.find(user => challenge.users[user]);
if (!state.userChallenges) return true;
return state.userChallenges.find(ch => challenge.id === ch);
}

/**
Expand Down