1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-01-10 12:24:20 +01:00

fix getipfs page

This commit is contained in:
Enrico Fasoli 2015-12-12 17:21:58 +01:00
parent b73704f08c
commit bd93fb7612

View File

@ -13,9 +13,6 @@ module.exports = React.createClass({
if(boards.isInit){ if(boards.isInit){
this.setState({ connected: true }) this.setState({ connected: true })
} else { } else {
setTimeout(_ => {
if(this.isMounted()) this.setState({ long: true })
}, 5000)
boards.getEventEmitter().on('init', err => { boards.getEventEmitter().on('init', err => {
if(!this.isMounted()) return if(!this.isMounted()) return
if(err){ if(err){
@ -25,11 +22,17 @@ module.exports = React.createClass({
} }
}) })
} }
} } else this.startTimer()
},
startTimer: function(){
setTimeout(_ => {
console.log('Connection to go-ipfs has timed out (probably due to CORS)')
if(this.isMounted()) this.setState({ long: true })
}, 5000)
}, },
render: function(){ render: function(){
var opt = require('options.jsx').get() var opt = require('options.jsx').get()
if(this.state.error){ if(this.state.error || this.state.long){
return ( return (
<div className=""> <div className="">
<h1><Icon name="ban"/> Connection to IPFS not available</h1> <h1><Icon name="ban"/> Connection to IPFS not available</h1>
@ -57,7 +60,6 @@ module.exports = React.createClass({
return <div className="center-block text-center"> return <div className="center-block text-center">
<Icon name="refresh" className="fa-3x center-block light fa-spin" /> <Icon name="refresh" className="fa-3x center-block light fa-spin" />
<h4>Connecting to IPFS</h4> <h4>Connecting to IPFS</h4>
{this.state.long?(<p>It's taking long... there's probably something wrong</p>):<p></p>}
</div> </div>
} }
} }