fix: update timeline without reload

Rather than pinging the server, this uses the current time.  It should
almost always be the same and only lasts until reload.
This commit is contained in:
Oliver Eyton-Williams
2019-10-17 22:51:08 +02:00
committed by Kristofer Koishigawa
parent 892e6862ed
commit 6316b47fbb

View File

@ -311,9 +311,11 @@ export const reducer = handleActions(
} }
}), }),
[types.submitComplete]: (state, { payload: { id, challArray } }) => { [types.submitComplete]: (state, { payload: { id, challArray } }) => {
let submitedchallneges = [{ id }]; // TODO: possibly more of the payload (files?) should be added
// to the completedChallenges array.
let submittedchallenges = [{ id, completedDate: Date.now() }];
if (challArray) { if (challArray) {
submitedchallneges = challArray; submittedchallenges = challArray;
} }
const { appUsername } = state; const { appUsername } = state;
return { return {
@ -325,7 +327,7 @@ export const reducer = handleActions(
...state.user[appUsername], ...state.user[appUsername],
completedChallenges: uniqBy( completedChallenges: uniqBy(
[ [
...submitedchallneges, ...submittedchallenges,
...state.user[appUsername].completedChallenges ...state.user[appUsername].completedChallenges
], ],
'id' 'id'