mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Use useSelect to fetch product warehouses
This commit is contained in:
@@ -86,13 +86,6 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
|||||||
quantity: number;
|
quantity: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== API DATA FETCHING =====
|
|
||||||
const allProductWarehousesUrl = `${ProductWarehouseApi.basePath}`;
|
|
||||||
const { data: allProductWarehouses } = useSWR(
|
|
||||||
allProductWarehousesUrl,
|
|
||||||
ProductWarehouseApi.getAllFetcher
|
|
||||||
);
|
|
||||||
|
|
||||||
// ===== USE SELECT HOOKS =====
|
// ===== USE SELECT HOOKS =====
|
||||||
const {
|
const {
|
||||||
setInputValue: setWarehouseSelectInputValue,
|
setInputValue: setWarehouseSelectInputValue,
|
||||||
@@ -101,6 +94,14 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
|||||||
rawData: warehouses,
|
rawData: warehouses,
|
||||||
} = useSelect<Warehouse>(WarehouseApi.basePath, 'id', 'name', 'search');
|
} = useSelect<Warehouse>(WarehouseApi.basePath, 'id', 'name', 'search');
|
||||||
|
|
||||||
|
const { rawData: allProductWarehouses } = useSelect<ProductWarehouse>(
|
||||||
|
ProductWarehouseApi.basePath,
|
||||||
|
'id',
|
||||||
|
'product.name',
|
||||||
|
'search',
|
||||||
|
{ limit: '100' }
|
||||||
|
);
|
||||||
|
|
||||||
// ===== SELECT INPUT DATA =====
|
// ===== SELECT INPUT DATA =====
|
||||||
const {
|
const {
|
||||||
setInputValue: setSupplierSelectInputValue,
|
setInputValue: setSupplierSelectInputValue,
|
||||||
|
|||||||
Reference in New Issue
Block a user