Hi all.
We are putting together a simple widget that displays a list of webmaps available to a given user. The initial webmap/basemap will be unsecured so there will be nothing within the webmap itself to trigger a login (assuming the user is not logged in already).
How can we get the widget to trigger the generic user login if it's not logged in, followed by continuing on to query for the list of webmaps?
Conceptually, I would have thought that the actual query would trigger a login but that doesn't appear to happen (unless we're doing something wrong).
Happy to take comments, pointers to examples or to provide more info if needed.
Cheers,
-Paul
Paul,
You should use the jimu/portalUtils:
var portal = portalUtils.getPortal(this.appConfig.portalUrl);
if(!portal.haveSignIn()){
portal.signIn().then(lang.hitch(this, function(){
portal.queryItems(params).then(lang.hitch(this, function(searchResponse){ //params: {q,sortField,sortOrder,num,start}
//do something with the searchResponse
});
});
}else{
portal.queryItems(params).then(lang.hitch(this, function(searchResponse){ //params: {q,sortField,sortOrder,num,start}
//do something with the searchResponse
});
}