fix(typo): Fixes typo the made the local completedChallenges array unusable (#142)
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
7c8b341533
commit
0326d12175
@ -1,4 +1,5 @@
|
|||||||
import { createAction, handleActions } from 'redux-actions';
|
import { createAction, handleActions } from 'redux-actions';
|
||||||
|
import { uniqBy } from 'lodash';
|
||||||
|
|
||||||
import { createTypes } from '../../../utils/stateManagment';
|
import { createTypes } from '../../../utils/stateManagment';
|
||||||
import { types as challenge } from '../../templates/Challenges/redux';
|
import { types as challenge } from '../../templates/Challenges/redux';
|
||||||
@ -72,14 +73,14 @@ export const reducer = handleActions(
|
|||||||
...state,
|
...state,
|
||||||
isSignedIn: payload
|
isSignedIn: payload
|
||||||
}),
|
}),
|
||||||
[challenge.submitComplete]: (state, { payload: { points, id } }) => ({
|
[challenge.submitComplete]: (state, { payload: { id } }) => ({
|
||||||
...state,
|
...state,
|
||||||
user: {
|
user: {
|
||||||
...state.user,
|
...state.user,
|
||||||
completedChallenges:
|
completedChallenges: uniqBy(
|
||||||
points === state.user.points
|
[...state.user.completedChallenges, { id }],
|
||||||
? state.user.completedChallenges
|
'id'
|
||||||
: [...state.user.completedChallengesSelector, { id }]
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user