From 0f4100a5077a60ae89b00d9a88ac85bb0a19ec81 Mon Sep 17 00:00:00 2001 From: wes Date: Tue, 20 Jun 2017 19:08:27 -0400 Subject: [PATCH] fix bugginness more --- src/scripts/editor.tag | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/scripts/editor.tag b/src/scripts/editor.tag index 7f5930b..e4fa32a 100644 --- a/src/scripts/editor.tag +++ b/src/scripts/editor.tag @@ -235,7 +235,7 @@ deletePost(_id) { } axios.get(`/blog/deletepost/${self._id}`) .then(function(resp) { - self.newPost(); + console.log(resp); self.listPosts(); }) .catch(function(err) { @@ -250,12 +250,18 @@ listPosts() { var postsList = Z.extend(Z.empty, resp.data); console.log(`trying to load post with id ${Z.focus(postsList, self.defaultPost)._id}`); 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( { "currentPosts" : postsList, - "isNewPost" : false, "_id" : currentPost._id } );