modifies payload authenticate middleware API and exposes errorHandler

This commit is contained in:
James
2020-08-13 16:02:19 -04:00
parent f32e7f8f4c
commit c7411fd347
2 changed files with 6 additions and 7 deletions

View File

@@ -88,14 +88,17 @@ class Payload {
// Enable static routes for all collections permitting upload
this.initStatic();
this.router.use(errorHandler(this.config));
this.errorHandler = errorHandler(this.config);
this.router.use(this.errorHandler);
if (typeof options.onInit === 'function') options.onInit();
this.authenticate = authenticate(this.config);
this.create = this.create.bind(this);
this.find = this.find.bind(this);
this.register = this.register.bind(this);
this.login = this.login.bind(this);
if (typeof options.onInit === 'function') options.onInit();
}
async sendEmail(message) {
@@ -109,10 +112,6 @@ class Payload {
return email.account;
}
authenticate() {
return authenticate(this.config);
}
async create(options) {
let { create } = localOperations;
create = create.bind(this);