Pārlūkot izejas kodu

Live debug edit

Lee Morgan 6 gadi atpakaļ
vecāks
revīzija
fbd57887fc
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 6 2
      controllers/renderer.js

+ 6 - 2
controllers/renderer.js

@@ -12,7 +12,7 @@ module.exports = {
     Renders landingPage
     */
     landingPage: function(req, res){
-        let activity = new Activity({
+        new Activity({
             ipAddr: req.headers['x-forwarded-for'] || req.connection.remoteAddress,
             merchant: req.session.user,
             route: "landing",
@@ -67,6 +67,7 @@ module.exports = {
             .populate("inventory.ingredient")
             .populate("recipes")
             .then(async (merchant)=>{
+                console.log("merchant found");
                 let promiseArray = [];
                 if(merchant.pos === "clover"){
                     const subscriptionCheck = axios.get(`${process.env.CLOVER_ADDRESS}/v3/apps/${process.env.SUBLINE_CLOVER_APPID}/merchants/${merchant.posId}/billing_info?access_token=${merchant.posAccessToken}`);
@@ -160,6 +161,7 @@ module.exports = {
                 return Promise.all([merchant.save()].concat(promiseArray));
             })
             .then((response)=>{
+                console.log("response after clover stuff");
                 let date = new Date();
                 let firstDay = new Date(date.getFullYear(), date.getMonth() - 1, 1);
 
@@ -175,6 +177,7 @@ module.exports = {
                     }}
                 ])
                     .then((transactions)=>{
+                        console.log("found all transactions");
                         response[0]._id = undefined;
                         response[0].posAccessToken = undefined;
                         response[0].lastUpdatedTime = undefined;
@@ -182,9 +185,10 @@ module.exports = {
 
                         return res.render("dashboardPage/dashboard", {merchant: response[0], transactions: transactions});
                     })
-                    .catch((err)=>{});
+                    .catch((err)=>{console.log(err)});
             })
             .catch((err)=>{
+                console.log(err);
                 req.session.error = "ERROR: UNABLE TO RETRIEVE USER DATA";
                 return res.redirect("/");
             });