1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00
- bugfix
- Alert message added(Private planet/Team member)
This commit is contained in:
Rokt33r
2015-08-24 13:45:28 +09:00
parent bfdf691bed
commit 15133d00c7
6 changed files with 52 additions and 37 deletions

View File

@@ -42,21 +42,26 @@ module.exports = React.createClass({
}
},
handleSubmit: function () {
Hq.createPlanet(this.state.ownerName, this.state.planet)
.then(function (res) {
var planet = res.body
this.setState({errorMessage: null}, function () {
Hq.createPlanet(this.state.ownerName, this.state.planet)
.then(function (res) {
var planet = res.body
PlanetStore.Actions.update(planet)
PlanetStore.Actions.update(planet)
if (this.props.transitionTo != null) {
this.props.transitionTo('planetHome', {userName: planet.userName, planetName: planet.name})
}
if (this.props.transitionTo != null) {
this.props.transitionTo('planetHome', {userName: planet.userName, planetName: planet.name})
}
this.props.close()
}.bind(this))
.catch(function (err) {
console.error(err)
})
this.props.close()
}.bind(this))
.catch(function (err) {
console.error(err)
if (err.status === 403) {
this.setState({errorMessage: err.response.body.message})
}
}.bind(this))
})
},
render: function () {
var teamOptions = this.state.user.Teams.map(function (team) {
@@ -81,6 +86,8 @@ module.exports = React.createClass({
</select>
</div>
{this.state.errorMessage != null ? (<p className='errorAlert'>{this.state.errorMessage}</p>) : null}
<button onClick={this.handleSubmit} className='submitButton'>
<i className='fa fa-check'/>
</button>