openmrs-esm-core

O3 Framework / getVisitTypes

Function: getVisitTypes()

getVisitTypes(url): Promise<VisitType[]>

Defined in: packages/framework/esm-emr-api/src/visit-type.ts:30

Fetches all available visit types from the OpenMRS REST API.

Parameters

url

string = visitTypesUrl

The endpoint to read from, defaulting to visitTypesUrl. This exists so that the function can be passed straight to SWR as a fetcher, which calls it with the cache key.

Returns

Promise<VisitType[]>

A Promise that resolves with an array of VisitType objects.

Example

import { getVisitTypes } from '@openmrs/esm-framework';
const visitTypes = await getVisitTypes();
console.log('Available visit types:', visitTypes);