remove type cast
This commit is contained in:
@@ -2,7 +2,6 @@ const { rest } = window.MockServiceWorker;
|
||||
import { RestHandler, MockedRequest, DefaultBodyType } from 'msw';
|
||||
import { umbPartialViewsData, umbPartialViewsTreeData } from '../data/partial-views.data.js';
|
||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||
import { CreateTextFileViewModelBaseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
const treeHandlers = [
|
||||
rest.get(umbracoPath('/tree/partial-view/root'), (req, res, ctx) => {
|
||||
@@ -35,8 +34,8 @@ const detailHandlers: RestHandler<MockedRequest<DefaultBodyType>>[] = [
|
||||
return res(ctx.status(200), ctx.json(response));
|
||||
}),
|
||||
|
||||
rest.post(umbracoPath('/partial-view'), (req, res, ctx) => {
|
||||
const requestBody = req.json() as CreateTextFileViewModelBaseModel;
|
||||
rest.post(umbracoPath('/partial-view'), async (req, res, ctx) => {
|
||||
const requestBody = await req.json();
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
const response = umbPartialViewsData.insertPartialView(requestBody);
|
||||
return res(ctx.status(200), ctx.json(response));
|
||||
@@ -49,8 +48,8 @@ const detailHandlers: RestHandler<MockedRequest<DefaultBodyType>>[] = [
|
||||
return res(ctx.status(200));
|
||||
}),
|
||||
|
||||
rest.put(umbracoPath('/partial-view'), (req, res, ctx) => {
|
||||
const requestBody = req.json() as CreateTextFileViewModelBaseModel;
|
||||
rest.put(umbracoPath('/partial-view'), async (req, res, ctx) => {
|
||||
const requestBody = await req.json();
|
||||
if (!requestBody) return res(ctx.status(400, 'no body found'));
|
||||
umbPartialViewsData.updateData(requestBody);
|
||||
return res(ctx.status(200));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { UmbDocumentTypeTreeItemModel } from './types.js';
|
||||
import type { UmbTreeDataSource } from '@umbraco-cms/backoffice/tree';
|
||||
import { DocumentTypeResource } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
@@ -9,7 +10,7 @@ import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
* @class UmbDocumentTypeTreeServerDataSource
|
||||
* @implements {UmbTreeDataSource}
|
||||
*/
|
||||
export class UmbDocumentTypeTreeServerDataSource implements UmbTreeDataSource {
|
||||
export class UmbDocumentTypeTreeServerDataSource implements UmbTreeDataSource<UmbDocumentTypeTreeItemModel> {
|
||||
#host: UmbControllerHost;
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ export class UmbDocumentTreeServerDataSource implements UmbTreeDataSource<Entity
|
||||
* @return {*}
|
||||
* @memberof UmbDocumentTreeServerDataSource
|
||||
*/
|
||||
async getChildrenOf(parentId: string | null): Promise<any> {
|
||||
async getChildrenOf(parentId: string | null) {
|
||||
/* TODO: should we make getRootItems() internal
|
||||
so it only is a server concern that there are two endpoints? */
|
||||
if (parentId === null) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { UmbMediaTypeTreeItemModel } from './types.js';
|
||||
import type { UmbTreeDataSource } from '@umbraco-cms/backoffice/tree';
|
||||
import { MediaTypeResource } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
@@ -9,7 +10,7 @@ import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
* @class UmbMediaTypeTreeServerDataSource
|
||||
* @implements {UmbTreeDataSource}
|
||||
*/
|
||||
export class UmbMediaTypeTreeServerDataSource implements UmbTreeDataSource {
|
||||
export class UmbMediaTypeTreeServerDataSource implements UmbTreeDataSource<UmbMediaTypeTreeItemModel> {
|
||||
#host: UmbControllerHost;
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ export class UmbMediaTreeServerDataSource implements UmbTreeDataSource<EntityTre
|
||||
* @return {*}
|
||||
* @memberof UmbMediaTreeServerDataSource
|
||||
*/
|
||||
async getChildrenOf(parentId: string | null): Promise<any> {
|
||||
async getChildrenOf(parentId: string | null) {
|
||||
/* TODO: should we make getRootItems() internal
|
||||
so it only is a server concern that there are two endpoints? */
|
||||
if (parentId === null) {
|
||||
|
||||
@@ -36,7 +36,7 @@ export class UmbMemberGroupTreeServerDataSource implements UmbTreeDataSource<Ent
|
||||
* @return {*}
|
||||
* @memberof UmbMemberGroupTreeServerDataSource
|
||||
*/
|
||||
async getChildrenOf(parentId: string | null): Promise<any> {
|
||||
async getChildrenOf(parentId: string | null) {
|
||||
/* TODO: should we make getRootItems() internal
|
||||
so it only is a server concern that there are two endpoints? */
|
||||
if (parentId === null) {
|
||||
|
||||
@@ -36,7 +36,7 @@ export class UmbMemberTypeTreeServerDataSource implements UmbTreeDataSource<Enti
|
||||
* @return {*}
|
||||
* @memberof UmbMemberTypeTreeServerDataSource
|
||||
*/
|
||||
async getChildrenOf(parentId: string | null): Promise<any> {
|
||||
async getChildrenOf(parentId: string | null) {
|
||||
/* TODO: should we make getRootItems() internal
|
||||
so it only is a server concern that there are two endpoints? */
|
||||
if (parentId === null) {
|
||||
|
||||
@@ -25,7 +25,7 @@ export class UmbMemberTreeServerDataSource implements UmbTreeDataSource<EntityTr
|
||||
* @return {*}
|
||||
* @memberof UmbMemberTreeServerDataSource
|
||||
*/
|
||||
async getRootItems(): Promise<any> {
|
||||
async getRootItems() {
|
||||
alert('not implemented');
|
||||
//return tryExecuteAndNotify(this.#host, MemberResource.getTreeMemberRoot({}));
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export class UmbMemberTreeServerDataSource implements UmbTreeDataSource<EntityTr
|
||||
* @return {*}
|
||||
* @memberof UmbMemberTreeServerDataSource
|
||||
*/
|
||||
async getChildrenOf(parentId: string | null): Promise<any> {
|
||||
async getChildrenOf(parentId: string | null) {
|
||||
alert('not implemented');
|
||||
/* TODO: should we make getRootItems() internal
|
||||
so it only is a server concern that there are two endpoints? */
|
||||
|
||||
@@ -36,7 +36,7 @@ export class UmbRelationTypeTreeServerDataSource implements UmbTreeDataSource<En
|
||||
* @return {*}
|
||||
* @memberof UmbRelationTypeTreeServerDataSource
|
||||
*/
|
||||
async getChildrenOf(parentId: string | null): Promise<any> {
|
||||
async getChildrenOf(parentId: string | null) {
|
||||
/* TODO: should we make getRootItems() internal
|
||||
so it only is a server concern that there are two endpoints? */
|
||||
if (parentId === null) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { UmbEntityTreeItemModel, UmbTreeDataSource } from '@umbraco-cms/backoffice/tree';
|
||||
import { UmbTemplateTreeItemModel } from './types.js';
|
||||
import type { UmbTreeDataSource } from '@umbraco-cms/backoffice/tree';
|
||||
import { TemplateResource } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
@@ -9,7 +10,7 @@ import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
* @class UmbTemplateTreeServerDataSource
|
||||
* @implements {UmbTreeDataSource}
|
||||
*/
|
||||
export class UmbTemplateTreeServerDataSource implements UmbTreeDataSource<UmbEntityTreeItemModel> {
|
||||
export class UmbTemplateTreeServerDataSource implements UmbTreeDataSource<UmbTemplateTreeItemModel> {
|
||||
#host: UmbControllerHost;
|
||||
|
||||
/**
|
||||
@@ -36,7 +37,7 @@ export class UmbTemplateTreeServerDataSource implements UmbTreeDataSource<UmbEnt
|
||||
* @return {*}
|
||||
* @memberof UmbTemplateTreeServerDataSource
|
||||
*/
|
||||
async getChildrenOf(parentId: string | null): Promise<any> {
|
||||
async getChildrenOf(parentId: string | null) {
|
||||
/* TODO: should we make getRootItems() internal
|
||||
so it only is a server concern that there are two endpoints? */
|
||||
if (parentId === null) {
|
||||
|
||||
Reference in New Issue
Block a user