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:
parent
e68adb7e25
commit
f830610dcd
@ -235,8 +235,11 @@ export default class RecordsPage extends Page {
|
||||
data[key] = field.value;
|
||||
});
|
||||
|
||||
// noinspection JSUnresolvedFunction
|
||||
const response = await this.model.create(data);
|
||||
// eslint-disable-next-line new-cap
|
||||
const instance: Model = new this.model();
|
||||
instance.setAttributes(data);
|
||||
|
||||
const response = await instance.save();
|
||||
if (response.getModelId()) {
|
||||
dialog.get(0)
|
||||
.close();
|
||||
|
10
resources/js/Models/Model.js
vendored
10
resources/js/Models/Model.js
vendored
@ -13,6 +13,16 @@ export default class Model extends BaseModel {
|
||||
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 {
|
||||
return '/api';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user