1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 10:46:32 +00:00

add OnlyGuest mixin

This commit is contained in:
Rokt33r
2015-07-12 19:24:44 +09:00
parent 7870c60ab4
commit 36eaebcbc7
5 changed files with 52 additions and 44 deletions

View File

@@ -0,0 +1,18 @@
var AuthStore = require('../Stores/AuthStore')
var OnlyGuest = {
componentDidMount: function () {
if (AuthStore.check()) {
var user = AuthStore.getUser()
console.log(user)
var planet = user.Planets.length > 0 ? user.Planets[0] : null
if (planet == null) {
this.transitionTo('user', {userName: user.name})
return
}
this.transitionTo('dashboard', {userName: user.name, planetName: planet.name})
}
}
}
module.exports = OnlyGuest