umbraco-restapi
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -64,7 +64,2 @@ var Content = require("./content"), | ||
//if (error) { | ||
// return console.log('Access Token Error', error.message); | ||
//} | ||
//create the authentication information | ||
@@ -71,0 +66,0 @@ var auth = oauth2.accessToken.create(result); |
@@ -77,13 +77,15 @@ var Ketting = require("ketting"); | ||
Content.prototype.query = async function(query) { | ||
var opt = { page: 1, size: 100, query: "" }; | ||
if (_.isString(query)) { | ||
opt.query = query; | ||
} else { | ||
_.assign(opt, query); | ||
} | ||
var resource = await this._ketting.follow("query", opt); | ||
var represenation = await resource.representation(); | ||
return { representation: represenation, resource: resource }; | ||
return await utill.catchException(() => { | ||
var opt = { page: 1, size: 100, query: "" }; | ||
if (_.isString(query)) { | ||
opt.query = query; | ||
} else { | ||
_.assign(opt, query); | ||
} | ||
var resource = await this._ketting.follow("query", opt); | ||
var represenation = await resource.representation(); | ||
return { representation: represenation, resource: resource }; | ||
}); | ||
}; | ||
@@ -90,0 +92,0 @@ |
{ | ||
"name": "umbraco-restapi", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Javascript library for accessing Umbraco website API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13
utill.js
var _ = require("lodash"); | ||
var catchException = async function( func ){ | ||
try{ | ||
var response = await func; | ||
return response; | ||
}catch(err){ | ||
return {error: err}; | ||
} | ||
}; | ||
//private function to query children/descendants/ancestors | ||
@@ -60,3 +69,5 @@ var axes = async function(ketting, axes, parent) { | ||
module.exports = { | ||
axes: axes | ||
axes: axes, | ||
relations: relations, | ||
catchException: catchException | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24939
407