33 lines
804 B
TypeScript
33 lines
804 B
TypeScript
import { getApiTemplates, getApiTemplatesById } from '@repo/loomart-sdk';
|
|
import { loomartClient } from './loomart-client';
|
|
|
|
export interface GetTemplatesParams {
|
|
page?: number;
|
|
size?: number;
|
|
search?: string;
|
|
categoryId?: string;
|
|
status?: 'AUDITING' | 'RELEASE' | 'EDITING';
|
|
}
|
|
|
|
export const getTemplates = async (params: GetTemplatesParams = {}) => {
|
|
const { data } = await getApiTemplates({
|
|
client: loomartClient,
|
|
query: {
|
|
page: params.page || 1,
|
|
size: params.size || 10,
|
|
search: params.search,
|
|
categoryId: params.categoryId,
|
|
status: params.status,
|
|
},
|
|
});
|
|
return data;
|
|
};
|
|
|
|
export const getTemplateById = async (id: string) => {
|
|
const { data } = await getApiTemplatesById({
|
|
client: loomartClient,
|
|
path: { id },
|
|
});
|
|
return data;
|
|
};
|