aurora-(1636, 1693): обновление справочника гк и юл и исправлена фильтрация юл без гк #201
@ -10,7 +10,7 @@ export const LE_PAGE = 200;
|
||||
export async function fetchCompanyGroups(params: GetCompanyGroupsPropsI): Promise<ICompanyGroupOut[]> {
|
||||
const all: ICompanyGroupOut[] = [];
|
||||
for (let offset = 0; ; offset += CG_PAGE) {
|
||||
const page = await api.get<Page<ICompanyGroupOut>>(`/directories/company-groups`, {
|
||||
const page = await api.get<Page<ICompanyGroupOut>>('/directories/company-groups', {
|
||||
limit: CG_PAGE,
|
||||
offset: offset,
|
||||
...params,
|
||||
|
||||
@ -5,11 +5,11 @@ import type { GetCompanyGroupsPropsI } from './types';
|
||||
|
||||
export const getCompanyGroupsThunk = createAsyncThunk<ICompanyGroup[], GetCompanyGroupsPropsI | undefined, { rejectValue: string }>(
|
||||
'company_groups/getAll',
|
||||
async (args = {}, thunkApi) => {
|
||||
async (args, thunkApi) => {
|
||||
try {
|
||||
return (await fetchCompanyGroups(args)).map(toCompanyGroupRow);
|
||||
return (await fetchCompanyGroups(args || {})).map(toCompanyGroupRow);
|
||||
} catch (e) {
|
||||
return thunkApi.rejectWithValue(e instanceof Error ? e.message : 'Ошибка');
|
||||
}
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
@ -36,7 +36,7 @@ export const CompanyGroupHeader = ({ setEditFormOpen, setDeleteConfirmOpen }: Co
|
||||
key: 'delete',
|
||||
icon: activeCompanyGroup?.is_archived ? <CheckCircleOutlined /> : <DeleteOutlined />,
|
||||
label: activeCompanyGroup?.is_archived ? 'Разархивировать' : 'Архивировать',
|
||||
danger: activeCompanyGroup?.is_archived ? false : true,
|
||||
danger: activeCompanyGroup?.is_archived,
|
||||
onClick: () => {
|
||||
setDeleteConfirmOpen(true);
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user