1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-23 14:41:44 +00:00

on Refactor... #3

This commit is contained in:
Rokt33r
2015-08-19 00:54:38 +09:00
parent d8cb93fb10
commit 484dfe6726
13 changed files with 369 additions and 522 deletions

View File

@@ -89,10 +89,25 @@ module.exports = React.createClass({
},
onPlanetChange: function (res) {
if (this.state.planet == null) return
console.log(res.data)
var code, note, articleIndex, articlesCount
var planet, code, note, articleIndex, articlesCount
switch (res.status) {
case 'updated':
planet = res.data
if (this.state.planet.id === planet.id) {
if (this.state.planet.name === planet.name) {
this.setState({planet: planet})
} else {
this.transitionTo('planetHome', {userName: planet.userName, planetName: planet.name})
}
}
break
case 'destroyed':
planet = res.data
if (this.state.planet.id === planet.id) {
this.transitionTo('userHome', {userName: this.state.planet.userName})
}
break
case 'codeUpdated':
code = res.data
if (code.PlanetId === this.state.planet.id) {