Hello all, I am trying to access the logged in user's credentials within an experience. Ideally, the username or user id would be used as part of a query on a layer.
I believe that I can get the credentials and set them as a global variable but cannot figure out how to access this information. I see that there is documentation about SessionManager but I am a relative newcomer to JS and am a bit lost.
Any help is greatly appreciated!
If you create an import at the top of your tsx/ts file to getAppStore eg
import { getAppStore } from 'jimu-core';
The you can make a call to get the state of the application, with
let state = getAppStore().getState();
The state object has the details of the logged in user. eg
Within a widget you can do:
this.props.user
This will give you an object with the current user's information. This object will be of type IUser