fix(client): sync Redux store and DB (#39034)
This commit is contained in:
committed by
GitHub
parent
0fd8b7a6db
commit
6b8c2e74b6
@ -370,7 +370,11 @@ function createVerifyCert(certTypeIds, app) {
|
||||
type: message.includes('Congratulations') ? 'success' : 'info',
|
||||
message
|
||||
},
|
||||
isCertMap: getUserIsCertMap(user)
|
||||
isCertMap: getUserIsCertMap(user),
|
||||
// send back the completed challenges
|
||||
// NOTE: we could just send back the latest challenge, but this
|
||||
// ensures the challenges are synced.
|
||||
completedChallenges: user.completedChallenges
|
||||
});
|
||||
}, next);
|
||||
};
|
||||
|
@ -482,12 +482,10 @@ export const reducer = handleActions(
|
||||
error: payload
|
||||
}
|
||||
}),
|
||||
[types.submitComplete]: (state, { payload: { id, challArray } }) => {
|
||||
// TODO: possibly more of the payload (files?) should be added
|
||||
// to the completedChallenges array.
|
||||
let submittedchallenges = [{ id, completedDate: Date.now() }];
|
||||
if (challArray) {
|
||||
submittedchallenges = challArray;
|
||||
[types.submitComplete]: (state, { payload }) => {
|
||||
let submittedchallenges = [{ ...payload, completedDate: Date.now() }];
|
||||
if (payload.challArray) {
|
||||
submittedchallenges = payload.challArray;
|
||||
}
|
||||
const { appUsername } = state;
|
||||
return {
|
||||
|
@ -79,9 +79,14 @@ function* validateUsernameSaga({ payload }) {
|
||||
function* verifyCertificationSaga({ payload }) {
|
||||
try {
|
||||
const {
|
||||
data: { response, isCertMap }
|
||||
data: { response, isCertMap, completedChallenges }
|
||||
} = yield call(putVerifyCert, payload);
|
||||
yield put(verifyCertComplete({ ...response, payload: isCertMap }));
|
||||
yield put(
|
||||
verifyCertComplete({
|
||||
...response,
|
||||
payload: { ...isCertMap, completedChallenges }
|
||||
})
|
||||
);
|
||||
yield put(createFlashMessage(response));
|
||||
} catch (e) {
|
||||
yield put(verifyCertError(e));
|
||||
|
Reference in New Issue
Block a user