Flatten the store of the profile feature
This commit is contained in:
parent
0e07020d09
commit
d02ab2c641
|
@ -11,5 +11,5 @@
|
|||
export function getProfile(state: Object) {
|
||||
const profileStateSlice = state['features/base/profile'];
|
||||
|
||||
return profileStateSlice ? profileStateSlice.profile || {} : {};
|
||||
return profileStateSlice || {};
|
||||
}
|
||||
|
|
|
@ -5,26 +5,18 @@ import { PersistenceRegistry } from '../storage';
|
|||
|
||||
import { PROFILE_UPDATED } from './actionTypes';
|
||||
|
||||
const DEFAULT_STATE = {
|
||||
profile: {}
|
||||
};
|
||||
|
||||
const STORE_NAME = 'features/base/profile';
|
||||
|
||||
/**
|
||||
* Sets up the persistence of the feature base/profile.
|
||||
*/
|
||||
PersistenceRegistry.register(STORE_NAME, {
|
||||
profile: true
|
||||
});
|
||||
PersistenceRegistry.register(STORE_NAME);
|
||||
|
||||
ReducerRegistry.register(
|
||||
STORE_NAME, (state = DEFAULT_STATE, action) => {
|
||||
STORE_NAME, (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case PROFILE_UPDATED:
|
||||
return {
|
||||
profile: action.profile
|
||||
};
|
||||
return action.profile;
|
||||
}
|
||||
|
||||
return state;
|
||||
|
|
Loading…
Reference in New Issue