tsc fixes

This commit is contained in:
Niels Lyngsø
2024-04-02 09:20:06 +02:00
parent ed449b36a3
commit 07795423ce
3 changed files with 18 additions and 8 deletions

View File

@@ -15,7 +15,6 @@ export * from './entity-action/index.js';
export * from './entity-bulk-action/index.js';
export * from './extension-registry/index.js';
export * from './id/index.js';
export * from './form/index.js';
export * from './menu/index.js';
export * from './modal/index.js';
export * from './notification/index.js';

View File

@@ -121,11 +121,16 @@ export class UmbLanguageWorkspaceContext
const { data } = await this.repository.create(newData);
if (data) {
this.setIsNew(false);
return true;
}
} else {
await this.repository.save(newData);
const { data } = await this.repository.save(newData);
if (data) {
return true;
}
// TODO: Show validation errors as warnings?
}
return false;
}
destroy(): void {

View File

@@ -101,15 +101,21 @@ export class UmbUserGroupWorkspaceContext
async submit() {
if (!this.#data.value) return;
//TODO: Could we clean this code up?
if (this.getIsNew()) {
await this.repository.create(this.#data.value);
const { data } = await this.repository.create(this.#data.value);
if (data) {
// If it went well, then its not new anymore?.
this.setIsNew(false);
return true;
}
} else if (this.#data.value.unique) {
await this.repository.save(this.#data.value);
} else return;
const { data } = await this.repository.save(this.#data.value);
if (data) {
return true;
}
}
// If it went well, then its not new anymore?.
this.setIsNew(false);
return false;
}
destroy(): void {