forked from Gitlink/forgeplus-react
上传websocket修改
This commit is contained in:
parent
358880bfd2
commit
fcc53f5278
|
@ -214,6 +214,10 @@ class Detail extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.timerChannel && clearTimeout(this.timerChannel);
|
||||
}
|
||||
|
||||
getProject = (num) => {
|
||||
const { projectsId, owner } = this.props.match.params;
|
||||
const url = `/${owner}/${projectsId}/simple.json`;
|
||||
|
@ -276,7 +280,9 @@ class Detail extends Component {
|
|||
connected: () => {
|
||||
console.log("###### channel connected! ######");
|
||||
},
|
||||
disconnected: () => { },
|
||||
disconnected: () => {
|
||||
console.log("###### cannot connected! ######");
|
||||
},
|
||||
received: data => {
|
||||
console.log(`###### ---received data--- ######`);
|
||||
console.log(data);
|
||||
|
@ -297,10 +303,22 @@ class Detail extends Component {
|
|||
});
|
||||
cable.subscriptions.consumer.disconnect();
|
||||
}
|
||||
},
|
||||
onerror:()=>{
|
||||
console.log("###### cannot connected! ######");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
this.timerChannel = setTimeout(this.reloadDetail,5000);
|
||||
}
|
||||
|
||||
reloadDetail=()=>{
|
||||
if(this.state.firstSync||this.state.secondSync){
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
deleteProjectBack = () => {
|
||||
const { history } = this.props;
|
||||
const { projectsId, owner } = this.props.match.params;
|
||||
|
|
Loading…
Reference in New Issue