Merge pull request #62 from cmgustavo/bug/01status

you are a great programmer!
This commit is contained in:
Mario Colque 2014-01-16 08:37:38 -08:00
commit eafe7bec14
3 changed files with 10 additions and 11 deletions

View File

@ -5,12 +5,11 @@
*/ */
var Status = require('../models/Status'); var Status = require('../models/Status');
var async = require('async');
/** /**
* Status * Status
*/ */
exports.show = function(req, res) { exports.show = function(req, res, next) {
if (! req.query.q) { if (! req.query.q) {
res.status(400).send('Bad Request'); res.status(400).send('Bad Request');
@ -19,25 +18,25 @@ exports.show = function(req, res) {
var s = req.query.q; var s = req.query.q;
var d = Status.new(); var d = Status.new();
if (s == 'getInfo') { if (s === 'getInfo') {
d.getInfo(function(err) { d.getInfo(function(err) {
if (err) next(err); if (err) next(err);
res.jsonp(d); res.jsonp(d);
}); });
} }
else if (s == 'getDifficulty') { else if (s === 'getDifficulty') {
d.getDifficulty(function(err) { d.getDifficulty(function(err) {
if (err) next(err); if (err) next(err);
res.jsonp(d); res.jsonp(d);
}); });
} }
else if (s == 'getTxOutSetInfo') { else if (s === 'getTxOutSetInfo') {
d.getTxOutSetInfo(function(err) { d.getTxOutSetInfo(function(err) {
if (err) next(err); if (err) next(err);
res.jsonp(d); res.jsonp(d);
}); });
} }
else if (s == 'getBestBlockHash') { else if (s === 'getBestBlockHash') {
d.getBestBlockHash(function(err) { d.getBestBlockHash(function(err) {
if (err) next(err); if (err) next(err);
res.jsonp(d); res.jsonp(d);

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var app = angular.module('mystery', angular.module('mystery',
['ngAnimate', ['ngAnimate',
'ngCookies', 'ngCookies',
'ngResource', 'ngResource',

View File

@ -7,16 +7,16 @@ angular.module('mystery.status').controller('StatusController', ['$scope', '$rou
Status.get({ Status.get({
q: q q: q
}, function(d) { }, function(d) {
if (q == 'getInfo') { if (q === 'getInfo') {
$scope.info = d.info; $scope.info = d.info;
} }
if (q == 'getDifficulty') { if (q === 'getDifficulty') {
$scope.difficulty = d.difficulty; $scope.difficulty = d.difficulty;
} }
if (q == 'getTxOutSetInfo') { if (q === 'getTxOutSetInfo') {
$scope.txoutsetinfo = d.txoutsetinfo; $scope.txoutsetinfo = d.txoutsetinfo;
} }
if (q == 'getBestBlockHash') { if (q === 'getBestBlockHash') {
$scope.bestblockhash = d.bestblockhash; $scope.bestblockhash = d.bestblockhash;
} }
}); });