1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-05-30 19:23:03 +00:00

add user management for planet setting modal

This commit is contained in:
Rokt33r
2015-07-24 19:05:11 +09:00
parent 2e4aaf7345
commit 867ec25e54
4 changed files with 87 additions and 4 deletions
+22
View File
@@ -12,6 +12,7 @@ var PlanetStore = Reflux.createStore({
this.listenTo(PlanetActions.fetchPlanet, this.fetchPlanet)
this.listenTo(PlanetActions.changeName, this.changeName)
this.listenTo(PlanetActions.addUser, this.addUser)
this.listenTo(PlanetActions.removeUser, this.removeUser)
this.listenTo(PlanetActions.createSnippet, this.createSnippet)
this.listenTo(PlanetActions.updateSnippet, this.updateSnippet)
this.listenTo(PlanetActions.deleteSnippet, this.deleteSnippet)
@@ -133,6 +134,27 @@ var PlanetStore = Reflux.createStore({
})
}.bind(this))
},
removeUser: function (planetName, userName) {
request
.del(apiUrl + planetName + '/users')
.set({
Authorization: 'Bearer ' + localStorage.getItem('token')
})
.send({name: userName})
.end(function (err, res) {
if (err) {
console.error(err)
this.trigger(null)
return
}
var user = res.body
this.trigger({
status: 'userRemoved',
data: user
})
}.bind(this))
},
createSnippet: function (planetName, input) {
input.description = input.description.substring(0, 255)
request