Exemple #1
0
				.end(function (err, res) {
					if (res.ok) {
						Actions.modifyPost.completed(res);
					} else {
						Actions.modifyPost.completed();
					}
				});
Exemple #2
0
				.end(function (err, res) {
					if (res.ok) {
						Actions.modifyPost.completed(res);
						// if there's already a post in our local store we need to modify it
						// if not, add this one
						var existingPostIdx = Array.findIndex(this.posts, function (post) {
							return res.body.id == post.id;
						});

						//console.log("POST IDX", existingPostIdx);
						if (existingPostIdx > -1) {
							this.posts[existingPostIdx] = res.body;
						} else {
							this.posts.push(res.body);
						}
					} else {
						Actions.modifyPost.completed();
					}
				}.bind(this));