1
0
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:
Rokt33r
2015-07-25 12:39:09 +09:00
parent 4df489bd10
commit 5dbfb24f1c
5 changed files with 51 additions and 3 deletions

View File

@@ -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)