diff --git a/scm-ui/src/containers/Login.js b/scm-ui/src/containers/Login.js index b0de9f3ab3..16f586e433 100644 --- a/scm-ui/src/containers/Login.js +++ b/scm-ui/src/containers/Login.js @@ -46,7 +46,6 @@ type Props = { // dispatcher props login: (link: string, username: string, password: string) => void, - fetchIndexResources: () => void, // context props t: string => string, @@ -94,7 +93,6 @@ class Login extends React.Component { } renderRedirect = () => { - this.props.fetchIndexResources(); const { from } = this.props.location.state || { from: { pathname: "/" } }; return ; }; @@ -165,8 +163,7 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { login: (loginLink: string, username: string, password: string) => - dispatch(login(loginLink, username, password)), - fetchIndexResources: () => dispatch(fetchIndexResources()) + dispatch(login(loginLink, username, password)) }; }; diff --git a/scm-ui/src/containers/Logout.js b/scm-ui/src/containers/Logout.js index 277e27130a..7875a6b92a 100644 --- a/scm-ui/src/containers/Logout.js +++ b/scm-ui/src/containers/Logout.js @@ -18,7 +18,6 @@ type Props = { loading: boolean, error: Error, logoutLink: string, - fetchIndexResources: () => void, // dispatcher functions logout: (link: string) => void, @@ -30,7 +29,6 @@ type Props = { class Logout extends React.Component { componentDidMount() { this.props.logout(this.props.logoutLink); - this.props.fetchIndexResources(); } render() { @@ -66,8 +64,7 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { - logout: (link: string) => dispatch(logout(link)), - fetchIndexResources: () => dispatch(fetchIndexResources()) + logout: (link: string) => dispatch(logout(link)) }; }; diff --git a/scm-ui/src/modules/auth.js b/scm-ui/src/modules/auth.js index 0723d8bf41..9a466b4802 100644 --- a/scm-ui/src/modules/auth.js +++ b/scm-ui/src/modules/auth.js @@ -5,7 +5,7 @@ import * as types from "./types"; import { apiClient, UNAUTHORIZED_ERROR } from "@scm-manager/ui-components"; import { isPending } from "./pending"; import { getFailure } from "./failure"; -import { callFetchIndexResources } from "./indexResource"; +import { callFetchIndexResources, fetchIndexResources } from "./indexResource"; // Action @@ -160,6 +160,9 @@ export const login = ( .then(me => { dispatch(loginSuccess(me)); }) + .then(() => { + dispatch(fetchIndexResources()); + }) .catch(err => { dispatch(loginFailure(err)); }); @@ -191,6 +194,9 @@ export const logout = (link: string) => { .then(() => { dispatch(logoutSuccess()); }) + .then(() => { + dispatch(fetchIndexResources()); + }) .catch(error => { dispatch(logoutFailure(error)); });