Make it possible for extensions to modify data before saving

This commit is contained in:
Toby Zerner 2015-05-14 22:02:46 +09:30
parent 6a46f3c1b1
commit 2069c7ab87
2 changed files with 17 additions and 7 deletions

View File

@ -27,13 +27,19 @@ export default class ComposerEdit extends ComposerBody {
return items;
}
onsubmit(content) {
data() {
return {
content: this.content()
};
}
onsubmit() {
var post = this.props.post;
this.loading(true);
m.redraw();
post.save({content}).then(post => {
post.save(this.data()).then(post => {
app.composer.hide();
m.redraw();
}, response => {

View File

@ -19,16 +19,20 @@ export default class ComposerReply extends ComposerBody {
return items;
}
onsubmit(value) {
data() {
return {
content: this.content(),
links: {discussion: this.props.discussion}
};
}
onsubmit() {
var discussion = this.props.discussion;
this.loading(true);
m.redraw();
var data = {
content: value,
links: {discussion}
};
var data = this.data();
app.store.createRecord('posts').save(data).then((post) => {
app.composer.hide();