blob: c3323e01bd40cff345b9b5fef02852d6bf80f2ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
export interface Product {
id: number;
name: string;
picture: string;
unitary_price: number;
bulk_price: number;
available_quantity: number;
quantity: number;
}
export function mapProduct(data: any) {
if(!data)
return null;
const product: Product = {
id: data.id,
name: data.attributes.name,
picture: data.attributes.picture,
unitary_price: data.attributes.unitary_price,
bulk_price: data.attributes.bulk_price,
available_quantity: data.attributes.available_quantity,
quantity: data.attributes.quantity
};
return product;
}
|