modifies payload authenticate middleware API and exposes errorHandler
This commit is contained in:
11
src/index.js
11
src/index.js
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user