пофикшены баги форматирования
This commit is contained in:
parent
082768f679
commit
ce539c4f35
@ -10,7 +10,7 @@ export const LE_PAGE = 200;
|
|||||||
export async function fetchCompanyGroups(params: GetCompanyGroupsPropsI): Promise<ICompanyGroupOut[]> {
|
export async function fetchCompanyGroups(params: GetCompanyGroupsPropsI): Promise<ICompanyGroupOut[]> {
|
||||||
const all: ICompanyGroupOut[] = [];
|
const all: ICompanyGroupOut[] = [];
|
||||||
for (let offset = 0; ; offset += CG_PAGE) {
|
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,
|
limit: CG_PAGE,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
...params,
|
...params,
|
||||||
|
|||||||
@ -5,11 +5,11 @@ import type { GetCompanyGroupsPropsI } from './types';
|
|||||||
|
|
||||||
export const getCompanyGroupsThunk = createAsyncThunk<ICompanyGroup[], GetCompanyGroupsPropsI | undefined, { rejectValue: string }>(
|
export const getCompanyGroupsThunk = createAsyncThunk<ICompanyGroup[], GetCompanyGroupsPropsI | undefined, { rejectValue: string }>(
|
||||||
'company_groups/getAll',
|
'company_groups/getAll',
|
||||||
async (args = {}, thunkApi) => {
|
async (args, thunkApi) => {
|
||||||
try {
|
try {
|
||||||
return (await fetchCompanyGroups(args)).map(toCompanyGroupRow);
|
return (await fetchCompanyGroups(args || {})).map(toCompanyGroupRow);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return thunkApi.rejectWithValue(e instanceof Error ? e.message : 'Ошибка');
|
return thunkApi.rejectWithValue(e instanceof Error ? e.message : 'Ошибка');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
);
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export const CompanyGroupHeader = ({ setEditFormOpen, setDeleteConfirmOpen }: Co
|
|||||||
key: 'delete',
|
key: 'delete',
|
||||||
icon: activeCompanyGroup?.is_archived ? <CheckCircleOutlined /> : <DeleteOutlined />,
|
icon: activeCompanyGroup?.is_archived ? <CheckCircleOutlined /> : <DeleteOutlined />,
|
||||||
label: activeCompanyGroup?.is_archived ? 'Разархивировать' : 'Архивировать',
|
label: activeCompanyGroup?.is_archived ? 'Разархивировать' : 'Архивировать',
|
||||||
danger: activeCompanyGroup?.is_archived ? false : true,
|
danger: activeCompanyGroup?.is_archived,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
setDeleteConfirmOpen(true);
|
setDeleteConfirmOpen(true);
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user