From 7efb082c43536edd254640f6120c0bac5137271f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Tue, 21 Aug 2018 09:17:15 +0200 Subject: [PATCH] reset error when loading config again --- scm-ui/src/config/containers/GlobalConfig.js | 8 +++++++- scm-ui/src/config/modules/config.js | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scm-ui/src/config/containers/GlobalConfig.js b/scm-ui/src/config/containers/GlobalConfig.js index 2f4aa3be22..ee02da9709 100644 --- a/scm-ui/src/config/containers/GlobalConfig.js +++ b/scm-ui/src/config/containers/GlobalConfig.js @@ -9,7 +9,8 @@ import { modifyConfig, isModifyConfigPending, getConfigUpdatePermission, - getModifyConfigFailure + getModifyConfigFailure, + modifyConfigReset } from "../modules/config"; import connect from "react-redux/es/connect/connect"; import ErrorPage from "../../components/ErrorPage"; @@ -28,6 +29,7 @@ type Props = { // context objects t: string => string, fetchConfig: void => void, + configReset: void => void, history: History }; @@ -38,6 +40,7 @@ class GlobalConfig extends React.Component { }; componentDidMount() { + this.props.configReset(); this.props.fetchConfig(); } @@ -83,6 +86,9 @@ const mapDispatchToProps = dispatch => { }, modifyConfig: (config: Config, callback?: () => void) => { dispatch(modifyConfig(config, callback)); + }, + configReset: () => { + dispatch(modifyConfigReset()); } }; }; diff --git a/scm-ui/src/config/modules/config.js b/scm-ui/src/config/modules/config.js index 4534dbaeb6..45c75348b6 100644 --- a/scm-ui/src/config/modules/config.js +++ b/scm-ui/src/config/modules/config.js @@ -16,6 +16,7 @@ export const MODIFY_CONFIG = "scm/config/MODIFY_CONFIG"; export const MODIFY_CONFIG_PENDING = `${MODIFY_CONFIG}_${types.PENDING_SUFFIX}`; export const MODIFY_CONFIG_SUCCESS = `${MODIFY_CONFIG}_${types.SUCCESS_SUFFIX}`; export const MODIFY_CONFIG_FAILURE = `${MODIFY_CONFIG}_${types.FAILURE_SUFFIX}`; +export const MODIFY_CONFIG_RESET = `${MODIFY_CONFIG}_${types.RESET_SUFFIX}`; const CONFIG_URL = "config"; const CONTENT_TYPE_CONFIG = "application/vnd.scmm-config+json;v=2"; @@ -66,7 +67,7 @@ export function modifyConfig(config: Config, callback?: () => void) { return function(dispatch: Dispatch) { dispatch(modifyConfigPending(config)); return apiClient - .put(config._links.update.href, config, CONTENT_TYPE_CONFIG) + .put(config._links.update.href + "letsfail!", config, CONTENT_TYPE_CONFIG) .then(() => { dispatch(modifyConfigSuccess(config)); if (callback) { @@ -108,6 +109,12 @@ export function modifyConfigFailure(config: Config, error: Error): Action { }; } +export function modifyConfigReset() { + return { + type: MODIFY_CONFIG_RESET + }; +} + //reducer function reducer(state: any = {}, action: any = {}) {