diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js index 03ec33ac..4287dabf 100644 --- a/web/src/UserEditPage.js +++ b/web/src/UserEditPage.js @@ -614,7 +614,7 @@ class UserEditPage extends React.Component { ); } - submitUserEdit(willExist) { + submitUserEdit(needExit) { const user = Setting.deepCopy(this.state.user); UserBackend.updateUser(this.state.organizationName, this.state.userName, user) .then((res) => { @@ -626,13 +626,18 @@ class UserEditPage extends React.Component { }); if (this.props.history !== undefined) { - if (willExist) { - this.props.history.push("/users"); + if (needExit) { + const userListUrl = sessionStorage.getItem("userListUrl"); + if (userListUrl !== null) { + this.props.history.push(userListUrl); + } else { + this.props.history.push("/users"); + } } else { this.props.history.push(`/users/${this.state.user.owner}/${this.state.user.name}`); } } else { - if (willExist) { + if (needExit) { if (this.state.returnUrl) { window.location.href = this.state.returnUrl; } diff --git a/web/src/UserListPage.js b/web/src/UserListPage.js index a3d2d93c..d686f9ec 100644 --- a/web/src/UserListPage.js +++ b/web/src/UserListPage.js @@ -70,6 +70,7 @@ class UserListPage extends BaseListPage { UserBackend.addUser(newUser) .then((res) => { if (res.status === "ok") { + sessionStorage.setItem("userListUrl", window.location.pathname); this.props.history.push({pathname: `/users/${newUser.owner}/${newUser.name}`, mode: "add"}); Setting.showMessage("success", i18next.t("general:Successfully added")); } else { @@ -341,7 +342,10 @@ class UserListPage extends BaseListPage { const disabled = (record.owner === this.props.account.owner && record.name === this.props.account.name); return (
- + this.deleteUser(index)} @@ -402,6 +406,8 @@ class UserListPage extends BaseListPage { const users = res.data; if (users.length > 0) { this.getOrganization(users[0].owner); + } else { + this.getOrganization(this.state.organizationName); } } else { if (Setting.isResponseDenied(res)) { @@ -430,6 +436,8 @@ class UserListPage extends BaseListPage { const users = res.data; if (users.length > 0) { this.getOrganization(users[0].owner); + } else { + this.getOrganization(this.state.organizationName); } } else { if (Setting.isResponseDenied(res)) {