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) {
|
export function getProfile(state: Object) {
|
||||||
const profileStateSlice = state['features/base/profile'];
|
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';
|
import { PROFILE_UPDATED } from './actionTypes';
|
||||||
|
|
||||||
const DEFAULT_STATE = {
|
|
||||||
profile: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
const STORE_NAME = 'features/base/profile';
|
const STORE_NAME = 'features/base/profile';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the persistence of the feature base/profile.
|
* Sets up the persistence of the feature base/profile.
|
||||||
*/
|
*/
|
||||||
PersistenceRegistry.register(STORE_NAME, {
|
PersistenceRegistry.register(STORE_NAME);
|
||||||
profile: true
|
|
||||||
});
|
|
||||||
|
|
||||||
ReducerRegistry.register(
|
ReducerRegistry.register(
|
||||||
STORE_NAME, (state = DEFAULT_STATE, action) => {
|
STORE_NAME, (state = {}, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case PROFILE_UPDATED:
|
case PROFILE_UPDATED:
|
||||||
return {
|
return action.profile;
|
||||||
profile: action.profile
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
|
Loading…
Reference in New Issue