Fixed url redirect after submission, upvoting now works

This commit is contained in:
Nathan Leniz
2015-03-05 19:40:44 +09:00
parent 41442a540f
commit 40a42e29c2
3 changed files with 7 additions and 7 deletions

View File

@@ -29,9 +29,11 @@ exports.index = function(req, res, next) {
exports.returnIndividualStory = function(req, res, next) {
var dashedName = req.params.storyName;
storyName = dashedName.replace(/\-/g, ' ');
var storyName = dashedName.replace(/\-/g, ' ');
Story.find({'headline' : new RegExp(storyName, 'i')}, function(err, story) {
debug('looking for %s', storyName);
Story.find({'storyLink' : new RegExp(storyName, 'i')}, function(err, story) {
if (err) {
next(err);
}
@@ -134,11 +136,10 @@ exports.storySubmission = function(req, res, next) {
story.save(function(err, data) {
if (err) {
throw err;
return res.status(500);
}
res.send(JSON.stringify({
storyLink: story.storyLink.replace(/\s/g, '-').toLowerCase()
}));
});
};