Skip to content

Commit 104f296

Browse files
Get SRMs via V4 API for now
1 parent 74ef6b5 commit 104f296

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/shared/actions/challenge-listing/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,15 @@ function getSrmsInit(uuid) {
285285
/**
286286
* Payload creator for the action that loads SRMs.
287287
* @param {String} uuid
288-
* @param {Number} memberId
288+
* @param {String} handle
289289
* @param {Object} params
290290
* @param {String} tokenV3
291291
*/
292-
function getSrmsDone(uuid, memberId, params, tokenV3) {
292+
function getSrmsDone(uuid, handle, params, tokenV3) {
293293
const service = getService(tokenV3);
294294
const promises = [service.getSrms(params)];
295-
if (memberId) {
296-
promises.push(service.getUserSrms(memberId, params));
295+
if (handle) {
296+
promises.push(service.getUserSrms(handle, params));
297297
}
298298
return Promise.all(promises).then((data) => {
299299
let srms = data[0];

src/shared/containers/Dashboard/index.jsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export class DashboardPageContainer extends React.Component {
111111
getSrms,
112112
// getTopcoderBlogFeed,
113113
handle,
114-
memberId,
115114
profile,
116115
srmsLoading,
117116
srmsTimestamp,
@@ -138,7 +137,7 @@ export class DashboardPageContainer extends React.Component {
138137
&& !financesLoading) getMemberFinances(handle, tokenV3);
139138

140139
if (now - srmsTimestamp > CACHE_MAX_AGE
141-
&& !srmsLoading) getSrms(memberId, tokenV3);
140+
&& !srmsLoading) getSrms(handle, tokenV3);
142141

143142
if (now - statsTimestamp > CACHE_MAX_AGE
144143
&& !statsLoading) getMemberStats(handle, tokenV3);
@@ -309,7 +308,6 @@ function mapStateToProps(state, props) {
309308
const communities = state.tcCommunities.list;
310309

311310
const userHandle = _.get(state.auth, 'user.handle');
312-
const userId = _.get(state.auth, 'user.userId');
313311
const member = state.members[userHandle] || {};
314312
const achievements = member.achievements || {};
315313
const finances = member.finances || {};
@@ -340,7 +338,6 @@ function mapStateToProps(state, props) {
340338
financesLoading: Boolean(finances.loadingUuid),
341339
financesTimestamp: finances.timestamp,
342340
handle: userHandle,
343-
memberId: userId,
344341
profile: state.auth.profile,
345342
showChallengeFilter: dash.showChallengeFilter,
346343
showEarnings: dash.showEarnings,
@@ -398,15 +395,14 @@ function mapDispatchToProps(dispatch) {
398395
dispatch(members.getStatsInit(handle, uuid));
399396
dispatch(members.getStatsDone(handle, uuid, tokenV3));
400397
},
401-
getSrms: (memberId, tokenV3) => {
398+
getSrms: (handle, tokenV3) => {
402399
const uuid = shortId();
403400
const a = challengeListingActions.challengeListing;
404401
dispatch(a.getSrmsInit(uuid));
405-
dispatch(a.getSrmsDone(uuid, memberId, {
406-
status: 'Draft',
407-
sortBy: 'startDate',
408-
page: 1,
409-
perPage: 3,
402+
dispatch(a.getSrmsDone(uuid, handle, {
403+
filter: 'status=future',
404+
orderBy: 'registrationStartAt',
405+
limit: 3,
410406
}, tokenV3));
411407
},
412408
getTopcoderBlogFeed: () => {

0 commit comments

Comments
 (0)