// Handlers import { genCrudHandler } from '~/handlers/_handler' // Services import { getList, create, update, remove } from '~/services/unit.service' // Types import type { Unit } from "~/models/unit"; export const { recId, recAction, recItem, isReadonly, isProcessing, isFormEntryDialogOpen, isRecordConfirmationOpen, onResetState, handleActionSave, handleActionEdit, handleActionRemove, handleCancelForm, } = genCrudHandler({ create, update, remove, }) 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?.data || [] data = resultData.map((item: Unit) => ({ value: item.id, label: item.name, })) } return data; }