BillBoard now Flyer. Changes to API and view logic
Fix to replace of null error. Changed Flyer to flyer
This commit is contained in:
@@ -7,7 +7,6 @@ import secrets from '../../config/secrets';
|
||||
module.exports = function(app) {
|
||||
const router = app.loopback.Router();
|
||||
const User = app.models.User;
|
||||
const BillBoard = app.models.BillBoard;
|
||||
router.get('/api/github', githubCalls);
|
||||
router.get('/api/blogger', bloggerCalls);
|
||||
router.get('/api/trello', trelloCalls);
|
||||
@@ -39,7 +38,6 @@ module.exports = function(app) {
|
||||
'/the-fastest-web-page-on-the-internet',
|
||||
theFastestWebPageOnTheInternet
|
||||
);
|
||||
router.get('/billBoard', billBoard);
|
||||
|
||||
app.use(router);
|
||||
|
||||
@@ -84,48 +82,6 @@ module.exports = function(app) {
|
||||
});
|
||||
}
|
||||
|
||||
function billBoard(req, res) {
|
||||
if (
|
||||
req.user
|
||||
&& typeof req.user.currentChallenge.challengeId !== 'undefined'
|
||||
) {
|
||||
BillBoard.findOne({}, function(err, data) {
|
||||
if (err) {
|
||||
res.send({
|
||||
err: {
|
||||
type: 'Error',
|
||||
message: 'Database Error'
|
||||
},
|
||||
data: null
|
||||
});
|
||||
} else {
|
||||
if (data.active) {
|
||||
res.send({
|
||||
err: null,
|
||||
data: data.message
|
||||
});
|
||||
} else {
|
||||
res.send({
|
||||
err: {
|
||||
type: 'warning',
|
||||
message: 'Bill Board is not active'
|
||||
},
|
||||
data: null
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
res.send({
|
||||
err: {
|
||||
type: 'warning',
|
||||
message: 'User Not Signed In'
|
||||
},
|
||||
data: null
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function theFastestWebPageOnTheInternet(req, res) {
|
||||
res.render('resources/the-fastest-web-page-on-the-internet', {
|
||||
title: 'This is the fastest web page on the internet'
|
||||
|
@@ -67,7 +67,7 @@
|
||||
"dataSource": "db",
|
||||
"public": true
|
||||
},
|
||||
"BillBoard": {
|
||||
"flyer": {
|
||||
"dataSource": "db",
|
||||
"public": true
|
||||
}
|
||||
|
Reference in New Issue
Block a user