blob: 0d6e489636a9fa2d12ea905148304f531fad9e00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// @flow
import { getAvatarURL } from '../utils';
import { SET_EMAIL, SET_NAME } from './actionTypes';
import { setAvatarURL } from './actions';
export default (store: Object) => (next: Function) => (action: Object) => {
const result = next(action);
const state = store.getState();
switch (action.type) {
case SET_EMAIL:
case SET_NAME: {
const avatarURL = getAvatarURL({
email: state.settings.email,
id: state.settings.name
});
store.dispatch(setAvatarURL(avatarURL));
}
}
return result;
};
|