|
@ -5,7 +5,7 @@ |
|
|
<ul> |
|
|
<ul> |
|
|
<li each={this.currentPosts}> |
|
|
<li each={this.currentPosts}> |
|
|
<p> |
|
|
<p> |
|
|
{title} by {author}, id = {_id} |
|
|
{title} by {author} |
|
|
</p> |
|
|
</p> |
|
|
<button |
|
|
<button |
|
|
class="btn btn-primary" |
|
|
class="btn btn-primary" |
|
@ -87,17 +87,19 @@ echo(ev) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
submit() { |
|
|
submit() { |
|
|
var post = self.querystring.stringify({ |
|
|
var post = { |
|
|
"title" : this.refs.title.value, |
|
|
"title" : this.refs.title.value, |
|
|
"author" : this.refs.author.value, |
|
|
"author" : this.refs.author.value, |
|
|
"content" : this.refs.textarea.value, |
|
|
"content" : this.refs.textarea.value, |
|
|
"csrf_token" : this.opts.csrf_token |
|
|
"csrf_token" : this.opts.csrf_token |
|
|
}); |
|
|
}; |
|
|
|
|
|
|
|
|
if (this._id) { |
|
|
if (this._id) { |
|
|
post["_id"] = this._id; |
|
|
post["_id"] = this._id; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var postQuery = self.querystring.stringify(post); |
|
|
|
|
|
|
|
|
var headers = { |
|
|
var headers = { |
|
|
"headers" : { |
|
|
"headers" : { |
|
|
"Content-Type" : "application/x-www-form-urlencoded", |
|
|
"Content-Type" : "application/x-www-form-urlencoded", |
|
@ -105,7 +107,7 @@ submit() { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
axios.post("/blog/insert/", post, headers) |
|
|
axios.post("/blog/insert/", postQuery, headers) |
|
|
.then(function(resp) { |
|
|
.then(function(resp) { |
|
|
console.log(resp); |
|
|
console.log(resp); |
|
|
}) |
|
|
}) |
|
|