mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 10:46:32 +00:00
add OnlyGuest mixin
This commit is contained in:
18
browser/main/Mixins/OnlyGuest.js
Normal file
18
browser/main/Mixins/OnlyGuest.js
Normal 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
|
||||
Reference in New Issue
Block a user