2017-12-14 17:02:32 +00:00
|
|
|
// @flow
|
|
|
|
|
2018-02-02 19:35:49 +00:00
|
|
|
import { ReducerRegistry } from '../redux';
|
|
|
|
import { PersistenceRegistry } from '../storage';
|
2017-12-14 17:02:32 +00:00
|
|
|
|
2018-01-29 22:20:38 +00:00
|
|
|
import { PROFILE_UPDATED } from './actionTypes';
|
|
|
|
|
2017-12-14 17:02:32 +00:00
|
|
|
const STORE_NAME = 'features/base/profile';
|
|
|
|
|
2018-02-02 19:35:49 +00:00
|
|
|
/**
|
|
|
|
* Sets up the persistence of the feature base/profile.
|
|
|
|
*/
|
2018-02-06 12:18:05 +00:00
|
|
|
PersistenceRegistry.register(STORE_NAME);
|
2018-01-17 11:19:10 +00:00
|
|
|
|
2017-12-14 17:02:32 +00:00
|
|
|
ReducerRegistry.register(
|
2018-02-06 12:18:05 +00:00
|
|
|
STORE_NAME, (state = {}, action) => {
|
2017-12-14 17:02:32 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case PROFILE_UPDATED:
|
2018-02-12 20:18:08 +00:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
...action.profile
|
|
|
|
};
|
2017-12-14 17:02:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
});
|