return data

This commit is contained in:
Niels Lyngsø
2023-03-29 14:27:36 +02:00
parent 95a2d5e4d8
commit 9189bb1c14
2 changed files with 12 additions and 12 deletions

View File

@@ -49,7 +49,7 @@ export class UmbWorkspaceDocumentTypeContext
}
async createScaffold(documentTypeKey: string) {
const { data } = await this.repository.createScaffold(documentTypeKey);
const { data } = await this.structure.createScaffold(documentTypeKey);
if (!data) return undefined;
this.setIsNew(true);
@@ -58,9 +58,7 @@ export class UmbWorkspaceDocumentTypeContext
}
async load(entityKey: string) {
this.structure.loadType(entityKey);
const { data } = await this.repository.requestByKey(entityKey);
const { data } = await this.structure.loadType(entityKey);
if (!data) return undefined;
this.setIsNew(false);

View File

@@ -35,27 +35,29 @@ export class UmbWorkspacePropertyStructureManager<R extends UmbDocumentTypeRepos
*/
public async loadType(key?: string) {
this._reset();
await this._loadType(key);
return await this._loadType(key);
}
public async createType(parentKey: string) {
public async createScaffold(parentKey: string) {
this._reset();
if (!parentKey) return;
if (!parentKey) return {};
const { data } = await this.#documentTypeRepository.createScaffold(parentKey);
if (!data) return;
if (!data) return {};
this._observeDocumentType(data);
await this._observeDocumentType(data);
return { data };
}
private async _loadType(key?: string) {
if (!key) return;
if (!key) return {};
const { data } = await this.#documentTypeRepository.requestByKey(key);
if (!data) return;
if (!data) return {};
this._observeDocumentType(data);
await this._observeDocumentType(data);
return { data };
}
public async _observeDocumentType(