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

add SnippetEditModal

This commit is contained in:
Rokt33r
2015-07-16 23:55:59 +09:00
parent ec686c9452
commit c2fcc72e62
9 changed files with 148 additions and 37 deletions

View File

@@ -8,6 +8,7 @@ var PlanetStore = Reflux.createStore({
init: function () {
this.listenTo(PlanetActions.fetchPlanet, this.fetchPlanet)
this.listenTo(PlanetActions.createSnippet, this.createSnippet)
this.listenTo(PlanetActions.updateSnippet, this.updateSnippet)
},
fetchPlanet: function (planetName) {
request
@@ -47,6 +48,27 @@ var PlanetStore = Reflux.createStore({
data: res.body
})
}.bind(this))
},
updateSnippet: function (id, input) {
request
.put('http://localhost:8000/snippets/id/' + id)
.set({
Authorization: 'Bearer ' + localStorage.getItem('token')
})
.send(input)
.end(function (err, res) {
if (err) {
console.error(err)
this.trigger(null)
return
}
var snippet = res.body
this.trigger({
status: 'snippetUpdated',
data: snippet
})
}.bind(this))
}
})