deleting
Usage
class User extends Model {
static entity = 'users'
static fields () {
return {
userId: this.attr(null),
published: this.attr(false)
}
}
static deleting (model) {
// change values before saving
model.published = true
if (model.userId === 2) {
// prevent model with userId 2 being saved in the store
return false
}
}
}
Typescript Declarations
export interface BeforeHook<M extends Model = Model> {
(model: M): void | boolean
}
const deleting: BeforeHook = () => {}
Table of Contents