// Login Controller
// ================
// Handles routing for logging into the pp

'use strict';

let express           = require('express'),
    QuotesController  = express.Router(),
    QClient           = require('q-client'),
    quotes            = new QClient(process.env.QClientID, process.env.QClientSecret);

    console.log(process.env.QClientID, process.env.QClientSecret);

QuotesController.route('/?')
  // GET /quotes/
  // ------------
  // Render quoting page
  .get(function(req, res, next) {
    res.render('quotes/index', {});
  })
  // POST /quotes/
  // ------------
  // Gets quotes
  .post(function(req, res, next) {
    quotes.getSubsidy('none', req.body.zip_code, req.body, function(err, results) {
      if (err) return next(new Error(err));
      res.json(JSON.parse(results));
    });
  });

module.exports = QuotesController;

// Login Controller
// ================
// Handles routing for logging into the pp

'use strict';

let express           = require('express'),
    QuotesController  = express.Router(),
    QClient           = require('q-client'),
    quotes            = new QClient(process.env.QClientID, process.env.QClientSecret);

    console.log(process.env.QClientID, process.env.QClientSecret);

QuotesController.route('/?')
  // GET /quotes/
  // ------------
  // Render quoting page
  .get(function(req, res, next) {
    res.render('quotes/index', {});
  })
  // POST /quotes/
  // ------------
  // Gets quotes
  .post(function(req, res, next) {
    quotes.getSubsidy('none', req.body.zip_code, req.body, function(err, results) {
      if (err)
        res.json({status: 'error', message: 'There was an error fetching quotes', details: err});
      else
        res.json(JSON.parse(results));
    });
  });

module.exports = QuotesController;

Fix whitespace between conditional statement.
style(controllers): Fix whitespace between conditional statement.

This commit makes it less likely that V8 will
misinterpret where our if/else statement begins and
ends. The error and success responses are easier to
read for both machines and humans.
