Skip to content

Commit f0ca587

Browse files
R0MANDEVcruzccl
authored andcommitted
portal/brand: actualized companies selectors to fetch 10000 items per page
1 parent 7d1b3b6 commit f0ca587

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

web/portal/brand/src/entities/Company/SelectOptions/ResidentialSelectOptions.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { DropdownChoices } from '@irontec/ivoz-ui';
22
import { SelectOptionsType } from '@irontec/ivoz-ui/entities/EntityInterface';
3-
import { fetchAllPages } from '@irontec/ivoz-ui/helpers/fechAllPages';
43
import store from 'store';
54

65
const ResidentialSelectOptions: SelectOptionsType = ({
@@ -9,21 +8,24 @@ const ResidentialSelectOptions: SelectOptionsType = ({
98
}): Promise<unknown> => {
109
const entities = store.getState().entities.entities;
1110
const Company = entities.Company;
11+
const getAction = store.getActions().api.get;
1212

13-
return fetchAllPages({
14-
endpoint: `${Company.path}?type=residential&_order[name]=ASC`,
13+
return getAction({
14+
path: `${Company.path}?type=residential&_order[name]=ASC`,
1515
params: {
16+
_pagination: false,
17+
_itemsPerPage: 10000,
18+
1619
_properties: ['id', 'name', 'company'],
1720
},
18-
setter: async (data) => {
21+
successCallback: async (data) => {
1922
const options: DropdownChoices = [];
2023
for (const item of data) {
2124
options.push({
2225
id: item.id,
2326
label: item.name,
2427
});
2528
}
26-
2729
callback(options);
2830
},
2931
cancelToken,

web/portal/brand/src/entities/Company/SelectOptions/RetailSelectOptions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { DropdownChoices } from '@irontec/ivoz-ui';
22
import { SelectOptionsType } from '@irontec/ivoz-ui/entities/EntityInterface';
3-
import { fetchAllPages } from '@irontec/ivoz-ui/helpers/fechAllPages';
43
import store from 'store';
54

65
const RetailSelectOptions: SelectOptionsType = ({
@@ -9,13 +8,16 @@ const RetailSelectOptions: SelectOptionsType = ({
98
}): Promise<unknown> => {
109
const entities = store.getState().entities.entities;
1110
const Company = entities.Company;
11+
const getAction = store.getActions().api.get;
1212

13-
return fetchAllPages({
14-
endpoint: `${Company.path}?type=retail&_order[name]=ASC`,
13+
return getAction({
14+
path: `${Company.path}?type=retail&_order[name]=ASC`,
1515
params: {
16+
_pagination: false,
17+
_itemsPerPage: 10000,
1618
_properties: ['id', 'name', 'company'],
1719
},
18-
setter: async (data) => {
20+
successCallback: async (data) => {
1921
const options: DropdownChoices = [];
2022
for (const item of data) {
2123
options.push({

web/portal/brand/src/entities/Company/SelectOptions/VpbxSelectOptions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { DropdownChoices } from '@irontec/ivoz-ui';
22
import { SelectOptionsType } from '@irontec/ivoz-ui/entities/EntityInterface';
3-
import { fetchAllPages } from '@irontec/ivoz-ui/helpers/fechAllPages';
43
import store from 'store';
54

65
const VpbxSelectOptions: SelectOptionsType = ({
@@ -9,13 +8,16 @@ const VpbxSelectOptions: SelectOptionsType = ({
98
}): Promise<unknown> => {
109
const entities = store.getState().entities.entities;
1110
const Company = entities.Company;
11+
const getAction = store.getActions().api.get;
1212

13-
return fetchAllPages({
14-
endpoint: `${Company.path}?type=vpbx&_order[name]=ASC`,
13+
return getAction({
14+
path: `${Company.path}?type=vpbx&_order[name]=ASC`,
1515
params: {
16+
_pagination: false,
17+
_itemsPerPage: 10000,
1618
_properties: ['id', 'name', 'company'],
1719
},
18-
setter: async (data) => {
20+
successCallback: async (data) => {
1921
const options: DropdownChoices = [];
2022
for (const item of data) {
2123
options.push({

web/portal/brand/src/entities/Company/SelectOptions/WholesaleSelectOptions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { DropdownChoices } from '@irontec/ivoz-ui';
22
import { SelectOptionsType } from '@irontec/ivoz-ui/entities/EntityInterface';
3-
import { fetchAllPages } from '@irontec/ivoz-ui/helpers/fechAllPages';
43
import store from 'store';
54

65
const WholesaleSelectOptions: SelectOptionsType = ({
@@ -9,13 +8,16 @@ const WholesaleSelectOptions: SelectOptionsType = ({
98
}): Promise<unknown> => {
109
const entities = store.getState().entities.entities;
1110
const Company = entities.Company;
11+
const getAction = store.getActions().api.get;
1212

13-
return fetchAllPages({
14-
endpoint: `${Company.path}?type=wholesale&_order[name]=ASC`,
13+
return getAction({
14+
path: `${Company.path}?type=wholesale&_order[name]=ASC`,
1515
params: {
16+
_pagination: false,
17+
_itemsPerPage: 10000,
1618
_properties: ['id', 'name', 'company'],
1719
},
18-
setter: async (data) => {
20+
successCallback: async (data) => {
1921
const options: DropdownChoices = [];
2022
for (const item of data) {
2123
options.push({

0 commit comments

Comments
 (0)