Workforce: fetch locations individually by ID instead of list endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
788628485b
commit
da0f97c47c
2 changed files with 15 additions and 5 deletions
|
|
@ -59,8 +59,16 @@ export async function findEmployeeById(wfUserId) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function getAllLocations() {
|
||||
return wfFetchPaged('/api/v2/locations')
|
||||
export async function getLocationsByIds(ids) {
|
||||
const results = await Promise.all(ids.map(async id => {
|
||||
try {
|
||||
const data = await wfFetch(`/api/v2/locations/${id}`)
|
||||
return { id: String(id), name: data.name ?? `Location ${id}`, short_name: data.short_name ?? null }
|
||||
} catch {
|
||||
return { id: String(id), name: `Location ${id}`, short_name: null }
|
||||
}
|
||||
}))
|
||||
return results
|
||||
}
|
||||
|
||||
export async function getAllDepartments() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue