Files
mixtape/zero.Backoffice.UI/app/modules/pages/api.ts
T

54 lines
2.9 KiB
TypeScript
Raw Normal View History

2021-12-20 00:39:39 +01:00
import { get, post, put, del, ApiRequestConfig, ApiRequestQuery } from '../../services/request';
export default {
2022-01-12 14:11:41 +01:00
tree: {
getChildren: (id: string, activeId?: string, search?: string, config?: ApiRequestConfig) => get(`backoffice/pages/${id}/children`, { ...config, params: { activeId, search } }),
},
2022-01-12 17:15:05 +01:00
getEmpty: (flavor?: string, parentId?: string, config?: ApiRequestConfig) => get("pages/empty", { ...config, params: { flavor, parentId } }),
getById: (id: string, changeVector?: string, config?: ApiRequestConfig) => get('pages/' + id, { ...config, params: { changeVector } }),
2022-01-12 23:52:37 +01:00
getByQuery: (query: ApiRequestQuery, config?: ApiRequestConfig) => get('pages', { ...config, params: { ...query } }),
2021-12-20 00:39:39 +01:00
getChildren: (id: string, query: ApiRequestQuery, config?: ApiRequestConfig) => get(`pages/${id}/children`, { ...config, params: { ...query } }),
2022-01-12 14:11:41 +01:00
getAllowedFlavors: (id: string, config?: ApiRequestConfig) => get(`pages/${id}/flavors`, { ...config }),
2021-12-20 13:03:56 +01:00
2022-01-12 14:11:41 +01:00
getDependencies: (id: string, config?: ApiRequestConfig) => get(`backoffice/pages/${id}/dependencies`, { ...config }),
2021-12-20 13:03:56 +01:00
2022-01-12 23:52:37 +01:00
getPreviews: (ids: string[], config?: ApiRequestConfig) => get(`backoffice/pages/previews`, { ...config, params: { ids } }),
2022-01-12 14:11:41 +01:00
create: (model: any, config?: ApiRequestConfig) => post('pages', model, config),
update: (model: any, config?: ApiRequestConfig) => put('pages/' + model.id, model, config),
move: (id: string, parentId: string, config?: ApiRequestConfig) => put(`pages/${id}/move/${parentId}`, {}, { ...config }),
copy: (id: string, parentId: string, includeDescendants?: boolean, config?: ApiRequestConfig) => put(`pages/${id}/copy/${parentId}`, {}, { ...config, params: { includeDescendants: (includeDescendants || false) } }),
2022-01-12 14:11:41 +01:00
sort: (ids: string[], config?: ApiRequestConfig) => put('pages/sort', ids, config),
delete: (id: string, config?: ApiRequestConfig) => del('pages/' + id, null, config),
2021-12-20 13:03:56 +01:00
2021-12-20 00:39:39 +01:00
//getTypes: (config?: ApiRequestConfig) => get('spaces/types', { ...config }),
//getType: (alias: string, config?: ApiRequestConfig) => get('spaces/types/' + alias, { ...config }),
//getByAlias: (alias: string, query?: ApiRequestQuery, config?: ApiRequestConfig) => get('spaces/' + alias, { ...config, params: { ...(query || {}) }}),
//getEmpty: (alias: string, config?: ApiRequestConfig) => get("spaces/empty", { ...config, params: { alias } }),
//getById: (id: string, changeVector?: string, config?: ApiRequestConfig) => get('countries/' + id, { ...config, params: { changeVector } }),
//getByQuery: (query: ApiRequestQuery, config?: ApiRequestConfig) => get('countries', { ...config, params: { ...query } }),
//create: (model: any, config?: ApiRequestConfig) => post('countries', model, config),
//update: (model: any, config?: ApiRequestConfig) => put('countries/' + model.id, model, config),
//delete: (id: string, config?: ApiRequestConfig) => del('countries/' + id, null, config),
};