|
@ -213,12 +213,11 @@ submit() { |
|
|
loadPost(_id) { |
|
|
loadPost(_id) { |
|
|
return function() { |
|
|
return function() { |
|
|
console.log("started loading"); |
|
|
console.log("started loading"); |
|
|
self.update({"loading" : true}); |
|
|
|
|
|
if (!_id) { |
|
|
if (!_id) { |
|
|
console.log("couldn't load the post"); |
|
|
console.log("couldn't load the post"); |
|
|
self.update({"loading" : false}); |
|
|
|
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
self.update({"loading" : true}); |
|
|
axios.get(`/blog/getpost/${_id}`) |
|
|
axios.get(`/blog/getpost/${_id}`) |
|
|
.then(function(resp) { |
|
|
.then(function(resp) { |
|
|
self.update({"loading" : false}); |
|
|
self.update({"loading" : false}); |
|
@ -244,10 +243,12 @@ deletePost(_id) { |
|
|
if (!_id) { |
|
|
if (!_id) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
self.update({"loading" : true}); |
|
|
axios.get(`/blog/deletepost/${self._id}`) |
|
|
axios.get(`/blog/deletepost/${self._id}`) |
|
|
.then(function(resp) { |
|
|
.then(function(resp) { |
|
|
console.log(resp); |
|
|
console.log(resp); |
|
|
self.listPosts(); |
|
|
self.listPosts(); |
|
|
|
|
|
self.update({"loading" : false}); |
|
|
}) |
|
|
}) |
|
|
.catch(function(err) { |
|
|
.catch(function(err) { |
|
|
console.log(err); |
|
|
console.log(err); |
|
|