openmrs-esm-core

O3 Framework / getSessionLocation

Function: getSessionLocation()

getSessionLocation(): Promise<undefined | SessionLocation>

Defined in: packages/framework/esm-api/src/current-user.ts:325

Returns a Promise that resolves with the current session location, if one is set. The session location represents the physical location where the user is currently working (e.g., a clinic or ward).

Returns

Promise<undefined | SessionLocation>

A Promise that resolves with the SessionLocation object, or undefined if no session location is set.

Example

import { getSessionLocation } from '@openmrs/esm-api';
const location = await getSessionLocation();
if (location) {
  console.log('Current location:', location.display);
}