Skip to content

Reskin profile alt #342

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

Merged
merged 2 commits into from
Jul 20, 2022
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
7 changes: 4 additions & 3 deletions src/actions/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,11 @@ async function getStatsDistributionDone(handle, track, subTrack, uuid, tokenV3)
* @desc Create an action that signals beginning of subtrack challenges loading.
* @param {String} handle Member handle.
* @param {String} uuid Operation UUID.
* @param {Number} pageNum Page index.
* @return {Action}
*/
async function getSubtrackChallengesInit(handle, uuid) {
return { handle, uuid };
async function getSubtrackChallengesInit(handle, uuid, pageNum) {
return { handle, uuid, pageNum };
}

/**
Expand Down Expand Up @@ -340,7 +341,7 @@ async function getSubtrackChallengesV4Done(
challenges: res.challenges,
refresh,
handle,
}));
})).catch(e => ({ handle, error: e }));
}

/**
Expand Down
32 changes: 24 additions & 8 deletions src/reducers/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,16 @@ function onGetActiveChallengesDone(state, { error, payload }) {
* @return {Object} New state.
*/
function onGetSubtrackChallengesInit(state, { payload }) {
const { handle, uuid } = payload;
const { handle, uuid, pageNum } = payload;

return {
...state,
[handle]: { ...state[handle], loadingSubTrackChallengesUUID: uuid },
[handle]: {
...state[handle],
loadingSubTrackChallengesUUID: uuid,
subtrackChallengesHasMore: false,
...(pageNum === 1 ? { subtrackChallenges: [] } : {}),
},
};
}

Expand All @@ -303,18 +309,28 @@ function onGetSubtrackChallengesInit(state, { payload }) {
* @return {Object} New state.
*/
function onGetSubtrackChallengesDone(state, { error, payload }) {
if (error) {
logger.error('Failed to get member subtrack challenges', payload);
fireErrorMessage('Failed to get member subtrack challenges', '');
return state;
}

const {
uuid,
challenges,
refresh,
handle,
error: payloadError,
} = payload;

if (error || payloadError) {
logger.error('Failed to get member subtrack challenges', payload);
fireErrorMessage('Failed to get member subtrack challenges', '');

return {
...state,
[handle]: {
...state[handle],
subtrackChallengesHasMore: false,
loadingSubTrackChallengesUUID: '',
},
};
}

if (uuid !== state[handle].loadingSubTrackChallengesUUID) return state;

return {
Expand Down