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