mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +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;
|
||||
}
|
||||
|
||||
// ===== API DATA FETCHING =====
|
||||
const allProductWarehousesUrl = `${ProductWarehouseApi.basePath}`;
|
||||
const { data: allProductWarehouses } = useSWR(
|
||||
allProductWarehousesUrl,
|
||||
ProductWarehouseApi.getAllFetcher
|
||||
);
|
||||
|
||||
// ===== USE SELECT HOOKS =====
|
||||
const {
|
||||
setInputValue: setWarehouseSelectInputValue,
|
||||
@@ -101,6 +94,14 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
rawData: warehouses,
|
||||
} = useSelect<Warehouse>(WarehouseApi.basePath, 'id', 'name', 'search');
|
||||
|
||||
const { rawData: allProductWarehouses } = useSelect<ProductWarehouse>(
|
||||
ProductWarehouseApi.basePath,
|
||||
'id',
|
||||
'product.name',
|
||||
'search',
|
||||
{ limit: '100' }
|
||||
);
|
||||
|
||||
// ===== SELECT INPUT DATA =====
|
||||
const {
|
||||
setInputValue: setSupplierSelectInputValue,
|
||||
|
||||
Reference in New Issue
Block a user