api.hbs 1014 B

12345678
  1. export const query{{pascalCase name}}{{pascalCase type}} = async (params?: Record<string, any>): Promise<any> => (await axios.get('/backend/core/{{kebabCase name}}', { params })).data;
  2. export const query{{pascalCase name}} = async (id: number): Promise<any> => (await axios.get(`/backend/core/{{kebabCase name}}/${id}`)).data;
  3. export const create{{pascalCase name}} = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/{{kebabCase name}}', data)).data;
  4. export const update{{pascalCase name}} = async (data: Record<string, any>): Promise<any> => (await axios.post('/backend/core/{{kebabCase name}}?_method=put', data)).data;
  5. {{#if isList}}
  6. export const update{{pascalCase name}}Order = async (data: number[]): Promise<any> => (await axios.post('/backend/core/{{kebabCase name}}/order?_method=put', data)).data;
  7. {{/if}}
  8. export const delete{{pascalCase name}} = async (data: number[]): Promise<any> => (await axios.post('/backend/core/{{kebabCase name}}?_method=delete', data)).data;