Progress, Deck done

This commit is contained in:
mgabdev
2020-12-16 17:29:06 -05:00
parent 8f94ffad9c
commit 04053c0e31
20 changed files with 473 additions and 93 deletions

View File

@@ -1,11 +1,17 @@
import {
DECK_CONNECT,
DECK_DISCONNECT,
DECK_SEARCH_USERS_CLEAR,
DECK_SEARCH_USERS_SUCCESS,
} from '../actions/deck'
import { Map as ImmutableMap } from 'immutable'
import {
Map as ImmutableMap,
List as ImmutableList,
} from 'immutable'
const initialState = ImmutableMap({
connected: false,
accountSuggestions: ImmutableList(),
})
export default function deck(state = initialState, action) {
@@ -14,6 +20,10 @@ export default function deck(state = initialState, action) {
return state.set('connected', true)
case DECK_DISCONNECT:
return state.set('connected', false)
case DECK_SEARCH_USERS_SUCCESS:
return state.set('accountSuggestions', ImmutableList(action.accounts.map((item) => item.id)))
case DECK_SEARCH_USERS_CLEAR:
return state.set('accountSuggestions', ImmutableList())
default:
return state;
}