@@ -81,7 +81,7 @@ const options = {
8181 qs: { options: " keyValues" }
8282};
8383
84- request (options, function (error , response , body ) {
84+ request (options, function (error , response , body ) {
8585 if (error) throw new Error (error);
8686 console .log (body);
8787});
@@ -307,7 +307,7 @@ GET request and make the necessary HTTP call:
307307
308308``` javascript
309309function retrieveEntity (entityId , opts ) {
310- return new Promise (function (resolve , reject ) {
310+ return new Promise (function (resolve , reject ) {
311311 const apiInstance = new NgsiV2.EntitiesApi ();
312312 apiInstance .retrieveEntity (entityId, opts, (error , data ) => {
313313 return error ? reject (error) : resolve (data);
@@ -321,11 +321,11 @@ This enables us to wrap the requests in `Promises` as shown:
321321``` javascript
322322function displayStore (req , res ) {
323323 retrieveEntity (req .params .storeId , { options: " keyValues" , type: " Store" })
324- .then (store => {
324+ .then (( store ) => {
325325 // If a store has been found display it on screen
326326 return res .render (" store" , { title: store .name , store });
327327 })
328- .catch (error => {
328+ .catch (( error ) => {
329329 debug (error);
330330 // If no store has been found, display an error screen
331331 return res .render (" store-error" , { title: " Error" , error });
@@ -427,22 +427,22 @@ function displayTillInfo(req, res) {
427427 type: " InventoryItem"
428428 })
429429 ])
430- .then (values => {
430+ .then (( values ) => {
431431 // If values have been found display it on screen
432432 return res .render (" till" , {
433433 products: values[0 ],
434434 inventory: values[1 ]
435435 });
436436 })
437- .catch (error => {
437+ .catch (( error ) => {
438438 debug (error);
439439 // An error occurred, return with no results
440440 return res .render (" till" , { products: {}, inventory: {} });
441441 });
442442}
443443
444444function listEntities (opts ) {
445- return new Promise (function (resolve , reject ) {
445+ return new Promise (function (resolve , reject ) {
446446 const apiInstance = new NgsiV2.EntitiesApi ();
447447 apiInstance .listEntities (opts, (error , data ) => {
448448 return error ? reject (error) : resolve (data);
@@ -516,7 +516,7 @@ async function buyItem(req, res) {
516516}
517517
518518function updateExistingEntityAttributes (entityId , body , opts ) {
519- return new Promise (function (resolve , reject ) {
519+ return new Promise (function (resolve , reject ) {
520520 const apiInstance = new NgsiV2.EntitiesApi ();
521521 apiInstance .updateExistingEntityAttributes (entityId, body, opts, (error , data ) => {
522522 return error ? reject (error) : resolve (data);
0 commit comments