Initial commit: expo-popcore project
This commit is contained in:
32
lib/api/templates.ts
Normal file
32
lib/api/templates.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user