mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
remove unnecessary fetches
This commit is contained in:
@@ -17,7 +17,6 @@ import ErrorPage from "../../components/ErrorPage";
|
||||
import type { Config } from "../types/Config";
|
||||
import ConfigForm from "../components/form/ConfigForm";
|
||||
import Loading from "../../components/Loading";
|
||||
import type { History } from "history";
|
||||
|
||||
type Props = {
|
||||
loading: boolean,
|
||||
@@ -31,23 +30,17 @@ type Props = {
|
||||
configReset: void => void,
|
||||
|
||||
// context objects
|
||||
t: string => string,
|
||||
history: History
|
||||
t: string => string
|
||||
};
|
||||
|
||||
class GlobalConfig extends React.Component<Props> {
|
||||
configModified = () => () => {
|
||||
this.props.fetchConfig();
|
||||
this.props.history.push(`/config`);
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.props.configReset();
|
||||
this.props.fetchConfig();
|
||||
}
|
||||
|
||||
modifyConfig = (config: Config) => {
|
||||
this.props.modifyConfig(config, this.configModified());
|
||||
this.props.modifyConfig(config);
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -132,6 +132,7 @@ function removeNullValues(config: Config) {
|
||||
|
||||
function reducer(state: any = {}, action: any = {}) {
|
||||
switch (action.type) {
|
||||
case MODIFY_CONFIG_SUCCESS:
|
||||
case FETCH_CONFIG_SUCCESS:
|
||||
const config = removeNullValues(action.payload);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user