Browse Source

add loader to delete, simplify loading state

pull/1/head
wes 7 years ago
parent
commit
5bd3c00c58
  1. 5
      src/scripts/editor.tag

5
src/scripts/editor.tag

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

Loading…
Cancel
Save