diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index e222d7b8..218b16f5 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -18,17 +18,18 @@ function Index(props){ const username = props.match.params.username; const pathname = props.history.location.pathname; const user = props.user; + const undo_messages = props.undo_messages; const [ menu , setMenu ] = useState("notify"); - const [ undo_messages , setMessages ] = useState("notify"); - const [ undo_transfer_projects , setTransferProjects ] = useState("notify"); + const [ messages , setMessages ] = useState(0); + const [ transferProjects , setTransferProjects ] = useState(0); useEffect(()=>{ - if(user){ - setMessages(user.undo_messages); + if(user && undo_messages){ + setMessages(undo_messages); setTransferProjects(user.undo_transfer_projects); } - },[user]) + },[user,undo_messages]) useEffect(()=>{ if(pathname && username){ @@ -55,13 +56,13 @@ function Index(props){
  • 通知 - {undo_messages ? {undo_messages}:""} + {messages ? {messages}:""}
  • 接收仓库 - {undo_transfer_projects ? {undo_transfer_projects}:""} + {transferProjects ? {transferProjects}:""}
  • diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index c4ac6699..d927f56f 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -37,13 +37,13 @@ function Notify(props){ if(status){ switch(status){ case 'canceled': - return `取消转移【${project && project.name}】仓库` + return

    取消转移【{project && project.name}】仓库

    case 'common': - return `正在将【${project && project.name}】仓库转移给【${owner && owner.name}】` + return

    正在将【{project && project.name}】仓库转移给【{owner && owner.name}】

    case 'successed': - return `【${project && project.name}】仓库成功转移给【${owner && owner.name}】` + return

    {project && project.name}】仓库成功转移给【{owner && owner.name}】

    default: - return `拒绝转移【${project && project.name}】仓库` + return

    拒绝转移【{project && project.name}】仓库

    } }else{ @@ -67,7 +67,7 @@ function Notify(props){ {i.applied_user && i.applied_user.name} {i.time_ago}

    -

    {renderStatus(i.status,i.applied)}

    + {renderStatus(i.status,i.applied)} ) diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index 4f105141..afb5c706 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -13,7 +13,6 @@ function UndoEvent(props){ const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); - useEffect(()=>{ if(username){ getList(); diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index 0759a6a9..06055044 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -53,7 +53,8 @@ class Infos extends Component { user: undefined, project_type: undefined, route_type: undefined, - undo_events:0 + undo_events:0, + undo_messages:0 }; } @@ -86,7 +87,8 @@ class Infos extends Component { this.setState({ user: result.data, isSpin: false, - undo_events:notice ? (e-p) : e + undo_events:notice ? (e-p) : e, + undo_messages:notice ? result.data && result.data.undo_messages : 0 }); }) .catch((error) => { @@ -123,7 +125,7 @@ class Infos extends Component { const {user} = this.state this.setState({ route_type: undefined, - project_type:"notice" + project_type:"notice", }) this.props.history.push(`/users/${user && user.login}/notice`) } @@ -148,7 +150,7 @@ class Infos extends Component { const { current_user, mygetHelmetapi } = this.props; const { username } = this.props.match.params; - const { user, isSpin, project_type, route_type , undo_events } = this.state; + const { user, isSpin, project_type, route_type , undo_events , undo_messages } = this.state; return (