Skip to content
Snippets Groups Projects
Commit 4536b574 authored by Alexandros Georgantas's avatar Alexandros Georgantas
Browse files

refactor(teams reducer): revert logic of delete

parent db27c386
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ import clone from 'lodash/clone'
import findIndex from 'lodash/findIndex'
import find from 'lodash/find'
import unionBy from 'lodash/unionBy'
import without from 'lodash/without'
import differenceBy from 'lodash/differenceBy'
import {
GET_TEAMS_SUCCESS,
......@@ -35,11 +35,7 @@ export default function(state = [], action) {
teams[index] = { ...teams[index], ...action.update }
return teams
}
function deleteTeam() {
const team = getTeam()
return without(teams, team)
}
switch (action.type) {
case CREATE_TEAM_SUCCESS:
return addTeam()
......@@ -48,7 +44,7 @@ export default function(state = [], action) {
case GET_TEAMS_SUCCESS:
return clone(action.teams)
case DELETE_TEAM_SUCCESS:
return deleteTeam()
return differenceBy(state, [action.team], 'id')
case LOGOUT_SUCCESS:
return []
case GET_COLLECTION_TEAMS_SUCCESS:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment