Skip to content

Commit

Permalink
Merge pull request #49 from swsnu/kichang/put_itemcount_fix
Browse files Browse the repository at this point in the history
fix edit itemcount error
  • Loading branch information
yankee624 committed Nov 14, 2020
2 parents 9742221 + 96eb184 commit e85bd89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/store/reducers/itemcount.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const itemcountReducer = (state = initialState, action) => {
return {...state, itemcounts: state.itemcounts.filter(ic => ic.id !== action.id)};
} else {
return {...state, itemcounts: state.itemcounts.map(ic => {
if (ic.id === action.id) return action.itemcounts;
if (ic.id === action.id) return action.itemcount;
else return ic;
})}
}
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/store/reducers/itemcount.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@ describe('itemcount reducer', () => {
type: actionTypes.EDIT_ITEMCOUNT,
is_deleted: false,
id: 2,
itemcounts: {
itemcount: {
'id': 2,
'itemId': 2,
'expirationDate': '20201123',
'count': 10
}
});

expect(updateState).toEqual({
itemcounts: [{
'id': 1,
Expand Down

0 comments on commit e85bd89

Please sign in to comment.