mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
(bug) configuring price does not edit the right prices
This commit is contained in:
parent
7c7ec0aa4c
commit
d3d285dfbe
@ -5,7 +5,7 @@ import ApiLib from '../lib/api';
|
||||
|
||||
export default class OrderAPI {
|
||||
static async index (filters?: OrderIndexFilter): Promise<OrderIndex> {
|
||||
const res: AxiosResponse<OrderIndex> = await apiClient.get(`/api/orders${ApiLib.filtersToQuery(filters)}`);
|
||||
const res: AxiosResponse<OrderIndex> = await apiClient.get(`/api/orders${ApiLib.filtersToQuery(filters, false)}`);
|
||||
return res?.data;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import ProductLib from '../lib/product';
|
||||
|
||||
export default class ProductAPI {
|
||||
static async index (filters?: ProductIndexFilter): Promise<ProductsIndex> {
|
||||
const res: AxiosResponse<ProductsIndex> = await apiClient.get(`/api/products${ApiLib.filtersToQuery(ProductLib.indexFiltersToIds(filters))}`);
|
||||
const res: AxiosResponse<ProductsIndex> = await apiClient.get(`/api/products${ApiLib.filtersToQuery(ProductLib.indexFiltersToIds(filters), false)}`);
|
||||
return res?.data;
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,11 @@ import _ from 'lodash';
|
||||
import { ApiFilter } from '../models/api';
|
||||
|
||||
export default class ApiLib {
|
||||
static filtersToQuery (filters?: ApiFilter): string {
|
||||
static filtersToQuery (filters?: ApiFilter, keepNullValues = true): string {
|
||||
if (!filters) return '';
|
||||
|
||||
return '?' + Object.entries(filters)
|
||||
.filter(filter => !_.isNil(filter[1]))
|
||||
.filter(filter => keepNullValues || !_.isNil(filter[1]))
|
||||
.map(filter => `${filter[0]}=${filter[1]}`)
|
||||
.join('&');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user