14841: Simplify configReducer
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 22 Feb 2019 16:04:38 +0000 (11:04 -0500)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 22 Feb 2019 20:03:41 +0000 (15:03 -0500)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

src/store/config/config-reducer.ts
src/views-components/main-app-bar/account-menu.tsx

index 070bae18497e1003421508efa9f8afc758197e8d..f0b76b148fc1cbacb0e23600949acc5a67ed2d00 100644 (file)
@@ -3,21 +3,13 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { configActions, ConfigAction } from "./config-action";
-import { Config, mockConfig } from '~/common/config';
+import { mockConfig } from '~/common/config';
 
-export interface ConfigState {
-    config: Config;
-}
-
-const initialState: ConfigState = {
-    config: mockConfig({}),
-};
-
-export const configReducer = (state = initialState, action: ConfigAction) => {
+export const configReducer = (state = mockConfig({}), action: ConfigAction) => {
     return configActions.match(action, {
         CONFIG: ({ config }) => {
             return {
-                ...state, config
+                ...state, ...config
             };
         },
         default: () => state
index c4f7e36f169028bce53d1774da47afd80920e6b1..271cf00f28a61df75f0f47b54a62b79f95fbd3cd 100644 (file)
@@ -30,7 +30,7 @@ interface AccountMenuProps {
 const mapStateToProps = (state: RootState): AccountMenuProps => ({
     user: state.auth.user,
     currentRoute: state.router.location ? state.router.location.pathname : '',
-    workbenchURL: state.config.config.workbenchUrl,
+    workbenchURL: state.config.workbenchUrl,
 });
 
 const wb1URL = (route: string) => {