Skip to content

Commit

Permalink
prevent hiddenFields of undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
massimocandela committed Jan 10, 2025
1 parent 175cccb commit 6f78b33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ export default class Model {
autoSave: options.autoSave ?? defaults.autoSave ?? null,
autoRefresh: options.autoRefresh ?? defaults.autoRefresh ?? false,
pre: options.pre ?? defaults.pre ?? null,
hiddenFields: options.hiddenFields ?? defaults.hiddenFields ?? [],
post: options.post ?? defaults.post ?? null
};
this.#store = null;
this.#includes = {};
this.#axios = this.options.axios || axios;
this.#hiddenFields = this.options.hiddenFields || [];
this.#hiddenFields = this.options.hiddenFields;
this.#loadFunction = this.options.load || null;

if (!name || !options) {
Expand Down Expand Up @@ -270,7 +271,7 @@ export default class Model {
};

#removeHiddenFields = (json) => {
for (let attribute of this.#hiddenFields ?? []) {
for (let attribute of this?.#hiddenFields ?? []) {
delete json[attribute];
}

Expand Down

0 comments on commit 6f78b33

Please sign in to comment.