add frontend
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { api } from './client'
|
||||
|
||||
export function fetchActiveEncounters(department) {
|
||||
const params = new URLSearchParams({ status: 'ACTIVE' })
|
||||
if (department) params.set('department', department)
|
||||
return api.get(`/api/v1/encounters?${params}`)
|
||||
}
|
||||
|
||||
export function fetchEncounter(id) {
|
||||
return api.get(`/api/v1/encounters/${id}`)
|
||||
}
|
||||
|
||||
export async function fetchObservations(encounterId, { limit = 50 } = {}) {
|
||||
const all = []
|
||||
let cursor = null
|
||||
do {
|
||||
const params = new URLSearchParams({ limit: String(limit) })
|
||||
if (cursor) params.set('cursor', cursor)
|
||||
const page = await api.get(`/api/v1/encounters/${encounterId}/observations?${params}`)
|
||||
all.push(...(page.items ?? []))
|
||||
cursor = page.hasMore ? page.nextCursor : null
|
||||
} while (cursor)
|
||||
return all
|
||||
}
|
||||
Reference in New Issue
Block a user