'use strict';

/**
 * @file Manages suggestion API endpoints
 */

var admins = require(__dirname + "/../libs/admins.js");

module.exports = function(app, db) {
    app.post('/suggestion/send', function(req, res) {
        admins.sendEmail(db, {
			subject: 'Suggestion From: ' + req.user.user,
			html: 'Suggestion From ' + req.user.user + "\n" + "Type: " + req.body.type + "\n" + "Submission: " + req.body.submission
		}, function(err) {
			if(err) {
				var errorMessage = err.message;
			} else {
				var errorMessage = null;
			}

			res.json({error: errorMessage});
		});
	});
}

@@ -453,87 +453,45 @@
 %09%09%09%09
-var errorMessage = err.message;%0A%09%09%09%7D else %7B%0A%09%09%09%09var errorMessage = null
+res.json(%7Berror: err.message%7D)
 ;%0A%09%09%09%7D%0A
-%0A
 %09%09%09r
@@ -502,29 +502,12 @@
 son(
-%7Berror: errorMessage%7D
+null
 );%0A%09

fix set header error