i have the below method to validate user and then retrieve the resources from jasper server. the user credentials are validated correctly. However, the "v" varialble is always null. please advise. kindly refer me to any typscript documentation for visualizejs.
public validateUser(userName: string, password: string, organization: string): Promise<any> { return new Promise(function(resolve, reject) { visualize({ auth: { name: userName, password: password, organization: organization } }, function() { resolve(); }, // successful validation function() { reject(); }, function (v) { console.log(v); v.resourcesSearch({ folderUri: "/public", recursive: true, types: ["reportUnit","dashboard"], }), //utility function function renderResults(results) { this.resourceDetails = results; console.log( this.resourceDetails); } }); });
1 Answer:
Posted on July 9, 2018 at 7:47am
fixed as below. i guess i had to read more the typescript and angularjs framework:
public getressources(): Promise<any> { return new Promise(function(renderResults) { visualize({ // already authenticated, so proceed with resource rendering }, function(v) { v.resourcesSearch({ folderUri: "/public", recursive: true, types: ["reportUnit","dashboard"], success: renderResults, error: handleError }); function renderResults(results) { this.resourceDetails = results; //console.log( this.resourceDetails); }; function handleError(err){ console.log(err.message); this.messageService.log(err.message); } }); } )}