Skip to content

Commit

Permalink
Fix initialState and remove role
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello committed Jul 1, 2021
1 parent ca45b19 commit fe71ea3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 1 addition & 3 deletions app/reducers/permissions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { PERMISSIONS } from '../actions/actionsTypes';

const initialState = {
permissions: {}
};
const initialState = {};

export default function permissions(state = initialState, action) {
switch (action.type) {
Expand Down
7 changes: 3 additions & 4 deletions app/reducers/roles.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ROLES } from '../actions/actionsTypes';

const initialState = {
roles: {}
};
const initialState = {};

export default function permissions(state = initialState, action) {
switch (action.type) {
Expand All @@ -14,7 +12,8 @@ export default function permissions(state = initialState, action) {
[action.payload.id]: action.payload.desc || action.payload.id
};
case ROLES.REMOVE:
return state.filter(role => role.id !== action.payload.id);
const { [action.payload.id]: roleRemoved, ...newState } = state;
return newState;
default:
return state;
}
Expand Down

0 comments on commit fe71ea3

Please sign in to comment.