Refactor product data structure and imports
- Added import for `Product` type in `_data.ts`. - Renamed `_products` to `_productsTextile` and defined a new array of product objects. - Updated `getProductsAsync` in `product-service.ts` to return the new `_products` array from mock data.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Filter } from 'src/api/filter-service';
|
||||
import { Product } from 'src/api/product-service';
|
||||
|
||||
import {
|
||||
_id,
|
||||
@@ -76,7 +77,7 @@ const COLORS = [
|
||||
'#FFC107',
|
||||
];
|
||||
|
||||
export const _products = [...Array(24)].map((_, index) => {
|
||||
export const _productsTextile = [...Array(24)].map((_, index) => {
|
||||
const setIndex = index + 1;
|
||||
|
||||
return {
|
||||
@@ -211,6 +212,19 @@ export const _notifications = [
|
||||
},
|
||||
];
|
||||
|
||||
export const _products: Product[] = [
|
||||
{
|
||||
id: '1',
|
||||
name: "User Manager",
|
||||
version: "1.0.0"
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
name: "Envelope Generator",
|
||||
version: "1.0.0"
|
||||
}
|
||||
];
|
||||
|
||||
export const _filters: Filter[] = [
|
||||
{ id: 1, label: 'Rechnungsnummer', name: 'invoiceNumber', type: 'VARCHAR' },
|
||||
{ id: 2, label: 'Kundenname', name: 'customerName', type: 'VARCHAR' },
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { _products } from "src/_mock";
|
||||
|
||||
export type Product = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -16,16 +18,5 @@ export type Product = {
|
||||
*/
|
||||
export function getProductsAsync(): Promise<Product[]> {
|
||||
//TODO: Implement the API call using fetch or axios
|
||||
return Promise.resolve([
|
||||
{
|
||||
id: '1',
|
||||
name: "User Manager",
|
||||
version: "1.0.0"
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
name: "Envelope Generator",
|
||||
version: "1.0.0"
|
||||
}
|
||||
]);
|
||||
return Promise.resolve(_products);
|
||||
}
|
||||
Reference in New Issue
Block a user