to_inventory/front/helpers.ts

30 lines
826 B
TypeScript

const config = useRuntimeConfig()
export const apiBase = config.public.apiBase
export type ApiTypeList = {
count: number;
next?: any;
previous?: any;
results: ApiTypeBase[]
}
export type ApiTypeBase =
ApiPartner | ApiInventory | ApiElement;
export type ApiPartner = { id: number, external_id: number }
export type ApiInventory = { id: number, partner: number }
export type ApiElement = { id: number, external_id: string, element_id: number, photo: string, additional_text: string, inventory: number }
export type ApiTypeExternal = {
'НаименованиеПолное': string;
Description: string;
Ref_Key: string;
}
export const makeColumns = (cols: string[]) => {
return cols.map(el => {
return {
key: el,
label: el.toUpperCase()
}
})
}