Browse Source

fix bugginness more

pull/1/head
wes 8 years ago
parent
commit
0f4100a507
  1. 12
      src/scripts/editor.tag

12
src/scripts/editor.tag

@ -235,7 +235,7 @@ deletePost(_id) {
} }
axios.get(`/blog/deletepost/${self._id}`) axios.get(`/blog/deletepost/${self._id}`)
.then(function(resp) { .then(function(resp) {
self.newPost(); console.log(resp);
self.listPosts(); self.listPosts();
}) })
.catch(function(err) { .catch(function(err) {
@ -250,12 +250,18 @@ listPosts() {
var postsList = Z.extend(Z.empty, resp.data); var postsList = Z.extend(Z.empty, resp.data);
console.log(`trying to load post with id ${Z.focus(postsList, self.defaultPost)._id}`); console.log(`trying to load post with id ${Z.focus(postsList, self.defaultPost)._id}`);
var currentPost = Z.focus(postsList, self.defaultPost); var currentPost = Z.focus(postsList, self.defaultPost);
self.one("updated", self.loadPost(currentPost._id)); var isNewPost;
if (currentPost == self.defaultPost) {
self.newPost();
}
else {
self.one("updated", self.loadPost(currentPost._id));
}
self.update( self.update(
{ {
"currentPosts" : postsList, "currentPosts" : postsList,
"isNewPost" : false,
"_id" : currentPost._id "_id" : currentPost._id
} }
); );

Loading…
Cancel
Save