0

When I ran the code without the variable 'idd' the code would run. but when I attached a variable rather than a static number to the 'Store({ ID: })', it would give me an error.

var idd;

function getid(){
    var pizzapi = require('dominos');
    pizzapi.Util.findNearbyStores(
        '07054',
        'Delivery',
        function(storeData){
            console.log(storeData.result.Stores[0].StoreID);
            idd = storeData.result.Stores[0].StoreID;
        }
    );
}

function menu(){
  var pizzapi = require('dominos');
  var myStore = new pizzapi.Store({ ID: idd });

  myStore.getMenu(
      function(storeData){
          console.log(storeData);
      }
  );
}

getid();
menu();

Message:

{
  success: false,
  message: 'A callback is required to get a store menu'
}
Nimantha
  • 6,405
  • 6
  • 28
  • 69
KevinF20
  • 13
  • 2

0 Answers0