fixes
This commit is contained in:
@ -42,7 +42,7 @@ export default class Model {
|
||||
}
|
||||
|
||||
get errors() {
|
||||
return this.data.__errors__
|
||||
return this.data && this.data.__errors__
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,6 +143,13 @@ export default class Model {
|
||||
return item === null ? item : new this(JSON.parse(item));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if model instance has no data
|
||||
*/
|
||||
get isEmpty() {
|
||||
return !this.data || Object.keys(this.data).findIndex(k => !!this.data[k] && this.data[k] !== 0) == -1
|
||||
}
|
||||
|
||||
/**
|
||||
* Return error for a specific attribute name if any
|
||||
*/
|
||||
|
Reference in New Issue
Block a user