2017-09-23 04:40:28 +01:00
|
|
|
import { List as ImmutableList } from 'immutable';
|
|
|
|
import { STORE_HYDRATE } from '../actions/store';
|
2017-09-23 13:47:32 +01:00
|
|
|
import { emojiIndex } from 'emoji-mart';
|
|
|
|
import { buildCustomEmojis } from '../emoji';
|
2017-09-23 04:40:28 +01:00
|
|
|
|
|
|
|
const initialState = ImmutableList();
|
|
|
|
|
2017-09-23 13:47:32 +01:00
|
|
|
export default function custom_emojis(state = initialState, action) {
|
2017-09-23 04:40:28 +01:00
|
|
|
switch(action.type) {
|
|
|
|
case STORE_HYDRATE:
|
2017-09-23 13:47:32 +01:00
|
|
|
emojiIndex.search('', { custom: buildCustomEmojis(action.state.get('custom_emojis', [])) });
|
2017-09-23 04:40:28 +01:00
|
|
|
return action.state.get('custom_emojis');
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|