call repo from workspace actions
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
import { UmbDocumentRepository } from '../../repository/document.repository';
|
||||
import { UmbEntityActionBase } from '../../../../shared/components/entity-action';
|
||||
import { UmbDocumentWorkspaceContext } from '../document-workspace.context';
|
||||
import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action';
|
||||
import { UmbControllerHostInterface } from '@umbraco-cms/controller';
|
||||
|
||||
export class UmbSaveAndPreviewDocumentWorkspaceAction extends UmbEntityActionBase<UmbDocumentRepository> {
|
||||
export class UmbSaveAndPreviewDocumentWorkspaceAction extends UmbWorkspaceAction<UmbDocumentRepository> {
|
||||
#workspaceContext?: UmbDocumentWorkspaceContext;
|
||||
|
||||
constructor(host: UmbControllerHostInterface, unique: string) {
|
||||
super(host, UmbDocumentRepository, unique);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
await this.repository.saveAndPreview();
|
||||
if (!this.workspaceContext) return;
|
||||
// TODO: it doesn't get the updated value
|
||||
const document = this.workspaceContext.getData();
|
||||
// TODO: handle errors
|
||||
if (!document) return;
|
||||
this.repository.saveAndPreview();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
import { UmbDocumentRepository } from '../../repository/document.repository';
|
||||
import { UmbEntityActionBase } from '../../../../shared/components/entity-action';
|
||||
import { UmbDocumentWorkspaceContext } from '../document-workspace.context';
|
||||
import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action';
|
||||
import { UmbControllerHostInterface } from '@umbraco-cms/controller';
|
||||
|
||||
export class UmbSaveAndPublishDocumentWorkspaceAction extends UmbEntityActionBase<UmbDocumentRepository> {
|
||||
export class UmbSaveAndPublishDocumentWorkspaceAction extends UmbWorkspaceAction<UmbDocumentRepository> {
|
||||
#workspaceContext?: UmbDocumentWorkspaceContext;
|
||||
|
||||
constructor(host: UmbControllerHostInterface, unique: string) {
|
||||
super(host, UmbDocumentRepository, unique);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
await this.repository.saveAndPublish();
|
||||
if (!this.workspaceContext) return;
|
||||
// TODO: it doesn't get the updated value
|
||||
const document = this.workspaceContext.getData();
|
||||
// TODO: handle errors
|
||||
if (!document) return;
|
||||
this.repository.saveAndPublish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
import { UmbDocumentRepository } from '../../repository/document.repository';
|
||||
import { UmbEntityActionBase } from '../../../../shared/components/entity-action';
|
||||
import { UmbDocumentWorkspaceContext } from '../document-workspace.context';
|
||||
import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action';
|
||||
import { UmbControllerHostInterface } from '@umbraco-cms/controller';
|
||||
|
||||
export class UmbSaveAndScheduleDocumentWorkspaceAction extends UmbEntityActionBase<UmbDocumentRepository> {
|
||||
export class UmbSaveAndScheduleDocumentWorkspaceAction extends UmbWorkspaceAction<UmbDocumentRepository> {
|
||||
#workspaceContext?: UmbDocumentWorkspaceContext;
|
||||
|
||||
constructor(host: UmbControllerHostInterface, unique: string) {
|
||||
super(host, UmbDocumentRepository, unique);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
await this.repository.saveAndSchedule();
|
||||
if (!this.workspaceContext) return;
|
||||
// TODO: it doesn't get the updated value
|
||||
const document = this.workspaceContext.getData();
|
||||
// TODO: handle errors
|
||||
if (!document) return;
|
||||
this.repository.saveAndSchedule();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user