新建项目

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 decoderPass = Base64.encode(values.password);
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, {
...values,
auth_password:decoderPass,
@ -208,9 +206,14 @@ class Index extends Component {
ignore_id,
user_id:owners_id
}).then((result) => {
if (result && result.data.id) {
projectsType && projectsType !== "mirror" && this.props.showNotification(`托管项目创建成功!`);
this.props.history.push(`/${result.data.login}/${result.data.identifier}`);
if (result) {
if (result.data.id) {
this.setState({
isSpin: false
})
this.props.showNotification(`${projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目创建成功!`);
this.props.history.push(`/projects/${owners_name}/${result.data.identifier}`);
}
}
this.setState({
isSpin: false