Browse Source

add getFeatures method to config-state

pull/8212/head
mehmet-erim 6 years ago
parent
commit
4afbd15a38
  1. 15
      npm/ng-packs/packages/core/src/lib/services/config-state.service.ts

15
npm/ng-packs/packages/core/src/lib/services/config-state.service.ts

@ -72,6 +72,21 @@ export class ConfigStateService {
return this.store.sliceState(state => state.features?.values?.[key]); return this.store.sliceState(state => state.features?.values?.[key]);
} }
getFeatures(keys: string[]) {
const { features } = this.store.state;
if (!features) return;
return keys.reduce((acc, key) => ({ ...acc, [key]: features.values[key] }), {});
}
getFeatures$(keys: string[]) {
return this.store.sliceState(({ features }) => {
if (!features?.values) return;
return keys.reduce((acc, key) => ({ ...acc, [key]: features.values[key] }), {});
});
}
getSetting(key: string) { getSetting(key: string) {
return this.store.state.setting?.values?.[key]; return this.store.state.setting?.values?.[key];
} }

Loading…
Cancel
Save