Added mock API data/handler
This commit is contained in:
@@ -36,6 +36,7 @@ import { handlers as partialViewHandlers } from './handlers/partial-view/index.j
|
||||
import { handlers as tagHandlers } from './handlers/tag-handlers.js';
|
||||
import { handlers as configHandlers } from './handlers/config.handlers.js';
|
||||
import { handlers as scriptHandlers } from './handlers/script/index.js';
|
||||
import { handlers as dynamicRootHandlers } from './handlers/dynamic-root.handlers.js';
|
||||
|
||||
const handlers = [
|
||||
serverHandlers.serverInformationHandler,
|
||||
@@ -46,6 +47,7 @@ const handlers = [
|
||||
...dictionaryHandlers,
|
||||
...documentHandlers,
|
||||
...documentTypeHandlers,
|
||||
...dynamicRootHandlers,
|
||||
...examineManagementHandlers,
|
||||
...healthCheckHandlers,
|
||||
...installHandlers,
|
||||
|
||||
@@ -227,6 +227,15 @@ export const data: Array<UmbMockDataTypeModel> = [
|
||||
value: {
|
||||
type: 'content',
|
||||
id: null,
|
||||
dynamicRoot: {
|
||||
originAlias: 'Root',
|
||||
querySteps: [
|
||||
{
|
||||
alias: 'FurthestAncestorOrSelf',
|
||||
anyOfDocTypeKeys: ['all-property-editors-document-type-id'],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { umbDocumentMockDb } from '../data/document/document.db.js';
|
||||
import type { DynamicRootRequestModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
const { rest } = window.MockServiceWorker;
|
||||
|
||||
export const handlers = [
|
||||
rest.post<DynamicRootRequestModel>(umbracoPath('/dynamic-root/query'), async (req, res, ctx) => {
|
||||
const response = umbDocumentMockDb.tree
|
||||
.getRoot()
|
||||
.items.map((item) => item.id)
|
||||
.slice(0, 1);
|
||||
return res(ctx.status(200), ctx.json(response));
|
||||
}),
|
||||
];
|
||||
Reference in New Issue
Block a user