1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-23 14:57:46 +01:00

fix: 🐛 Model non viene salvato

This commit is contained in:
Maicol Battistini 2021-10-08 16:49:17 +02:00
parent e68adb7e25
commit f830610dcd
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A
2 changed files with 15 additions and 2 deletions

View File

@ -235,8 +235,11 @@ export default class RecordsPage extends Page {
data[key] = field.value; data[key] = field.value;
}); });
// noinspection JSUnresolvedFunction // eslint-disable-next-line new-cap
const response = await this.model.create(data); const instance: Model = new this.model();
instance.setAttributes(data);
const response = await instance.save();
if (response.getModelId()) { if (response.getModelId()) {
dialog.get(0) dialog.get(0)
.close(); .close();

View File

@ -13,6 +13,16 @@ export default class Model extends BaseModel {
return super.getAttribute(attributeName); return super.getAttribute(attributeName);
} }
setAttribute(attributeName: string, value: any): void {
super.setAttribute(attributeName, value);
}
setAttributes(attributes: { [string]: any }): void {
for (const [attribute, value] of Object.entries(attributes)) {
this.setAttribute(attribute, value);
}
}
getJsonApiBaseUrl(): string { getJsonApiBaseUrl(): string {
return '/api'; return '/api';
} }