Browse Source

fix duplicates

pull/1/head
wes 7 years ago
parent
commit
17337e6b84
  1. 6
      src/scripts/editor.tag
  2. 7
      src/scripts/zipper.js

6
src/scripts/editor.tag

@ -166,7 +166,7 @@ submit() {
/* Refresh the current list of posts */
self._id = resp.data[0];
self.listPosts();
console.log(self.currentPosts);
console.log(Z.toJS(self.currentPosts));
})
.catch(function(err) {
console.log(err);
@ -197,9 +197,9 @@ deletePost(_id) {
return function() {
axios.get(`/blog/deletepost/${self.currentPost()._id}`)
.then(function(resp) {
self.update({"currentPosts" : Z.empty});
self.newPost();
self.listPosts();
console.log(Z.toJS(self.currentPosts));
})
.catch(function(err) {
console.log(err);
@ -212,7 +212,7 @@ listPosts() {
.then(function(resp) {
self.update(
{
"currentPosts" : Z.extend(self.currentPosts, resp.data)
"currentPosts" : Z.extend(Z.empty, resp.data)
}
);
})

7
src/scripts/zipper.js

@ -7,6 +7,10 @@ function Zipper(left, right) {
};
}
function toJS(z) {
return [z.left.toJS(), z.right.toJS()];
}
function fromList(xs) {
return Zipper(im.Stack(), im.Stack(xs));
}
@ -61,5 +65,6 @@ export default {
"empty" : empty,
"fromList" : fromList,
"extend" : extend,
"removeCurrent" : removeCurrent
"removeCurrent" : removeCurrent,
"toJS" : toJS
};

Loading…
Cancel
Save