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