feat: update
This commit is contained in:
@ -16,6 +16,10 @@ function transformPageParams(params: API.PageParams & Record<string, any>) {
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function camelToSnakeCase(str: string) {
|
||||||
|
return str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1_$2').toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
function transformSort(sort: Record<string, SortOrder>) {
|
function transformSort(sort: Record<string, SortOrder>) {
|
||||||
if (!sort) {
|
if (!sort) {
|
||||||
return {};
|
return {};
|
||||||
@ -25,7 +29,7 @@ function transformSort(sort: Record<string, SortOrder>) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const asc = sort[sortField] === 'ascend';
|
const asc = sort[sortField] === 'ascend';
|
||||||
return { sortField, asc };
|
return { sortField: camelToSnakeCase(sortField), asc };
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortTableList<T extends { created: number; updated: number }>(
|
function sortTableList<T extends { created: number; updated: number }>(
|
||||||
@ -43,9 +47,12 @@ function sortTableList<T extends { created: number; updated: number }>(
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getJobList(params: API.PageParams & Partial<API.JobListItem>, options?: {
|
export async function getJobList(
|
||||||
[key: string]: any
|
params: API.PageParams & Partial<API.JobListItem>,
|
||||||
}) {
|
options?: {
|
||||||
|
[key: string]: any;
|
||||||
|
},
|
||||||
|
) {
|
||||||
if (!params.category) {
|
if (!params.category) {
|
||||||
params.category = JobType.All;
|
params.category = JobType.All;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user