...
An Observable that produces zero or more values (as described above). The values produced will be a user object (if includeAuthStatus is set to false) or an object with a session and authenticated property (if includeAuthStatus is set to true).
Example
import { getCurrentUser } from '@openmrs/esm-api'
const subscription = getCurrentUser().subscribe(
user => console.log(user)
)
subscription.unsubscribe()
getCurrentUser({includeAuthStatus: true}).subscribe(
data => console.log(data.authenticated)
)
...
Otherwise your code will continue getting updates to the user object even after the UI component is gone from the screen. This is a memory leak and source of bugs.
refetchCurrentUser(): Observable
The refetchCurrentUser function causes a network request to redownload the user. All subscribers to the current user will be notified of the new users once the new version of the user object is downloaded.
Arguments
None
Return value
An observable exactly the same as if you had called getCurrentUser().
Example
import { refetchCurrentUser } from '@openmrs/esm-api'
refetchCurrentUser()