mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-21 05:31:45 +00:00
add delete planet request
This commit is contained in:
@@ -10,6 +10,7 @@ var PlanetStore = Reflux.createStore({
|
||||
init: function () {
|
||||
this.listenTo(PlanetActions.createPlanet, this.createPlanet)
|
||||
this.listenTo(PlanetActions.fetchPlanet, this.fetchPlanet)
|
||||
this.listenTo(PlanetActions.deletePlanet, this.deletePlanet)
|
||||
this.listenTo(PlanetActions.changeName, this.changeName)
|
||||
this.listenTo(PlanetActions.addUser, this.addUser)
|
||||
this.listenTo(PlanetActions.removeUser, this.removeUser)
|
||||
@@ -81,6 +82,25 @@ var PlanetStore = Reflux.createStore({
|
||||
})
|
||||
}.bind(this))
|
||||
},
|
||||
deletePlanet: function (userName, planetName) {
|
||||
request
|
||||
.del(apiUrl + userName + '/' + planetName)
|
||||
.send()
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
this.trigger(null)
|
||||
return
|
||||
}
|
||||
|
||||
var planet = res.body
|
||||
|
||||
this.trigger({
|
||||
status: 'planetDeleted',
|
||||
data: planet
|
||||
})
|
||||
}.bind(this))
|
||||
},
|
||||
changeName: function (userName, planetName, name) {
|
||||
request
|
||||
.put(apiUrl + userName + '/' + planetName)
|
||||
|
||||
Reference in New Issue
Block a user