新建项目

This commit is contained in:
caishi 2021-03-25 22:05:27 +08:00 committed by caishi
parent 3bebbdc44d
commit 987688bcc9
1 changed files with 8 additions and 5 deletions

View File

@ -197,8 +197,6 @@ class Index extends Component {
const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state; const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state;
const decoderPass = Base64.encode(values.password); const decoderPass = Base64.encode(values.password);
const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json"; const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json";
// 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值
sessionStorage.newProjectValue=JSON.stringify({...values,project_language_id,project_category_id,license_id,ignore_id});
axios.post(url, { axios.post(url, {
...values, ...values,
auth_password:decoderPass, auth_password:decoderPass,
@ -208,9 +206,14 @@ class Index extends Component {
ignore_id, ignore_id,
user_id:owners_id user_id:owners_id
}).then((result) => { }).then((result) => {
if (result && result.data.id) { if (result) {
projectsType && projectsType !== "mirror" && this.props.showNotification(`托管项目创建成功!`); if (result.data.id) {
this.props.history.push(`/${result.data.login}/${result.data.identifier}`); this.setState({
isSpin: false
})
this.props.showNotification(`${projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目创建成功!`);
this.props.history.push(`/projects/${owners_name}/${result.data.identifier}`);
}
} }
this.setState({ this.setState({
isSpin: false isSpin: false