Files
simrsx-fe/app/services/vclaim-region-city.service.ts
2025-10-22 14:27:43 +07:00

28 lines
724 B
TypeScript

// Base
import * as base from './_crud-base'
const path = '/api/vclaim/cities'
const name = 'cities'
export function getList(params: any = null) {
let url = path
if (params?.province) {
url += `/${params.province}`
delete params.province
}
return base.getList(url, params, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
let data: { value: string; label: string }[] = []
const result = await getList(params)
if (result.success) {
const resultData = result.body?.response?.list || []
data = resultData.map((item: any) => ({
value: item.kode ? String(item.kode) : '',
label: item.nama,
}))
}
return data
}