Skip to content

Commit

Permalink
Add case for remove action in reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
RobPando committed Jul 9, 2020
1 parent 6f89f65 commit 4305245
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ONLINE,
OFFLINE,
RESET_QUEUE,
REMOVE_ACTION,
} from './actions'

/**
Expand All @@ -30,6 +31,12 @@ export default function reducer(state = INITIAL_STATE, action = {}) {
return { ...state, isConnected: true }
case OFFLINE:
return { ...state, isConnected: false }
case REMOVE_ACTION: {
if (action.payload.uuid) {
const filteredQueue = state.queue.filter(queuedAction => queuedAction.meta.uuid !== uuid)
return { ...state, queue: [...filteredQueue] }
}
}
case RESET_QUEUE:
return { ...state, queue: [] }
default:
Expand Down

0 comments on commit 4305245

Please sign in to comment.