Here's the error log ReferenceError: callback is not defined at Object. (C:\Users\Username\Desktop\JsGame-master\APP.JS:137:45) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Function.Module.runMain (module.js:447:10) at startup (node.js:146:18) at node.js:404:3
var connection = Syncano({apiKey: 'abc',
userKey: 'abc',
defaults: {
instanceName: "interactiveboard",
className: "players"
}
});
var DataObject = connection.DataObject;
DataObject .please() .list() .then(function(res) {
console.log(res);
});
var dataObject = {
avatar: "Geralt",
nickname: "Rivia",
email:"whatevershit@gmail.com"
};
DataObject.please().create(DataObject).then(callback);
This is happening because the callback
you are passing into DataObject.please().create(DataObject).then(callback);
is not defined anywhere.
You could solve this in two ways.
One would be to define a callback before you pass it into that call like this:
var callback = function(res) { console.log(res); };
The other would be to change your last line to pass the function directly into the then
call like this:
DataObject.please().create(DataObject).then(function(res) {
console.log(res);
});
Hope this helps!