mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
correct reloading of index resources after logn/logout
This commit is contained in:
@@ -46,7 +46,6 @@ type Props = {
|
|||||||
|
|
||||||
// dispatcher props
|
// dispatcher props
|
||||||
login: (link: string, username: string, password: string) => void,
|
login: (link: string, username: string, password: string) => void,
|
||||||
fetchIndexResources: () => void,
|
|
||||||
|
|
||||||
// context props
|
// context props
|
||||||
t: string => string,
|
t: string => string,
|
||||||
@@ -94,7 +93,6 @@ class Login extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderRedirect = () => {
|
renderRedirect = () => {
|
||||||
this.props.fetchIndexResources();
|
|
||||||
const { from } = this.props.location.state || { from: { pathname: "/" } };
|
const { from } = this.props.location.state || { from: { pathname: "/" } };
|
||||||
return <Redirect to={from} />;
|
return <Redirect to={from} />;
|
||||||
};
|
};
|
||||||
@@ -165,8 +163,7 @@ const mapStateToProps = state => {
|
|||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
login: (loginLink: string, username: string, password: string) =>
|
login: (loginLink: string, username: string, password: string) =>
|
||||||
dispatch(login(loginLink, username, password)),
|
dispatch(login(loginLink, username, password))
|
||||||
fetchIndexResources: () => dispatch(fetchIndexResources())
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ type Props = {
|
|||||||
loading: boolean,
|
loading: boolean,
|
||||||
error: Error,
|
error: Error,
|
||||||
logoutLink: string,
|
logoutLink: string,
|
||||||
fetchIndexResources: () => void,
|
|
||||||
|
|
||||||
// dispatcher functions
|
// dispatcher functions
|
||||||
logout: (link: string) => void,
|
logout: (link: string) => void,
|
||||||
@@ -30,7 +29,6 @@ type Props = {
|
|||||||
class Logout extends React.Component<Props> {
|
class Logout extends React.Component<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.logout(this.props.logoutLink);
|
this.props.logout(this.props.logoutLink);
|
||||||
this.props.fetchIndexResources();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -66,8 +64,7 @@ const mapStateToProps = state => {
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
logout: (link: string) => dispatch(logout(link)),
|
logout: (link: string) => dispatch(logout(link))
|
||||||
fetchIndexResources: () => dispatch(fetchIndexResources())
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as types from "./types";
|
|||||||
import { apiClient, UNAUTHORIZED_ERROR } from "@scm-manager/ui-components";
|
import { apiClient, UNAUTHORIZED_ERROR } from "@scm-manager/ui-components";
|
||||||
import { isPending } from "./pending";
|
import { isPending } from "./pending";
|
||||||
import { getFailure } from "./failure";
|
import { getFailure } from "./failure";
|
||||||
import { callFetchIndexResources } from "./indexResource";
|
import { callFetchIndexResources, fetchIndexResources } from "./indexResource";
|
||||||
|
|
||||||
// Action
|
// Action
|
||||||
|
|
||||||
@@ -160,6 +160,9 @@ export const login = (
|
|||||||
.then(me => {
|
.then(me => {
|
||||||
dispatch(loginSuccess(me));
|
dispatch(loginSuccess(me));
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
dispatch(fetchIndexResources());
|
||||||
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
dispatch(loginFailure(err));
|
dispatch(loginFailure(err));
|
||||||
});
|
});
|
||||||
@@ -191,6 +194,9 @@ export const logout = (link: string) => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
dispatch(logoutSuccess());
|
dispatch(logoutSuccess());
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
dispatch(fetchIndexResources());
|
||||||
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
dispatch(logoutFailure(error));
|
dispatch(logoutFailure(error));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user